mirror of
https://github.com/esjeon/krohnkite.git
synced 2024-10-03 23:07:13 +03:00
make WindowResizeDelta dumb
This commit is contained in:
parent
c134e60fcd
commit
f119d47a4e
@ -19,23 +19,26 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
class WindowResizeDelta {
|
||||
public readonly diff: Rect;
|
||||
public readonly east: number;
|
||||
public readonly west: number;
|
||||
public readonly south: number;
|
||||
public readonly north: number;
|
||||
public static fromWindow(window: Window): WindowResizeDelta {
|
||||
const diff = window.actualGeometry.subtract(window.geometry);
|
||||
return new WindowResizeDelta(
|
||||
diff.width + diff.x,
|
||||
-diff.x,
|
||||
diff.height + diff.y,
|
||||
-diff.y,
|
||||
);
|
||||
}
|
||||
|
||||
public constructor(window: Window) {
|
||||
this.diff = window.actualGeometry.subtract(window.geometry);
|
||||
this.east = this.diff.width + this.diff.x;
|
||||
this.west = -this.diff.x;
|
||||
this.south = this.diff.height + this.diff.y;
|
||||
this.north = -this.diff.y;
|
||||
constructor(
|
||||
public readonly east: number,
|
||||
public readonly west: number,
|
||||
public readonly south: number,
|
||||
public readonly north: number,
|
||||
) {
|
||||
}
|
||||
|
||||
public toString(): string {
|
||||
return "WindowResizeDelta(" + [
|
||||
"diff=" + this.diff,
|
||||
"east=" + this.east,
|
||||
"west=" + this.west,
|
||||
"north=" + this.north,
|
||||
|
@ -43,7 +43,7 @@ class QuarterLayout implements ILayout {
|
||||
if (idx < 0)
|
||||
return;
|
||||
|
||||
const delta = new WindowResizeDelta(basis);
|
||||
const delta = WindowResizeDelta.fromWindow(basis);
|
||||
|
||||
/* vertical split */
|
||||
if ((idx === 0 || idx === 3) && delta.east !== 0)
|
||||
|
@ -44,7 +44,7 @@ class TileLayout implements ILayout {
|
||||
if (idx < 0)
|
||||
return;
|
||||
|
||||
const delta = new WindowResizeDelta(basis);
|
||||
const delta = WindowResizeDelta.fromWindow(basis);
|
||||
if (idx < this.numMaster) { /* master tiles */
|
||||
if (delta.east !== 0) {
|
||||
const newMasterWidth = Math.floor(area.width * this.masterRatio) + delta.east;
|
||||
|
Loading…
Reference in New Issue
Block a user