From ec6c4fb6bf1f7063c79129bcc9e3be32e26aa267 Mon Sep 17 00:00:00 2001 From: Fabian Homborg <FHomborg@gmail.com> Date: Wed, 23 Oct 2013 18:53:16 +0200 Subject: [PATCH] Fix resizing in Bladelayout --- contents/code/bladelayout.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/contents/code/bladelayout.js b/contents/code/bladelayout.js index f1c6eb5..986ef61 100644 --- a/contents/code/bladelayout.js +++ b/contents/code/bladelayout.js @@ -156,9 +156,9 @@ BladeLayout.prototype.resizeTile = function(tileIndex, rectangle) { if (rectangle.x + rectangle.width > this.screenRectangle.x + this.screenRectangle.width) { rectangle.width = this.screenRectangle.x + this.screenRectangle.width - rectangle.x; } - var newRect = Qt.Rect(this.screenRectangle.x, + var newRect = Qt.rect(this.screenRectangle.x, this.screenRectangle.y, - Math.floor(rectangle.x / tileIndex), + Math.floor((rectangle.x - this.screenRectangle.x) / tileIndex), this.screenRectangle.height); for(i = 0; i < tileIndex; i++) { var rect = this.tiles[i].rectangle; @@ -166,10 +166,14 @@ BladeLayout.prototype.resizeTile = function(tileIndex, rectangle) { rect.width = newRect.width; this.tiles[i].rectangle = rect; } - newRect.width = Math.floor((this.screenRectangle.width - rectangle.x) / (this.tiles.length - tileIndex - 1)); + // Rightmost point - Right edge of resized window / number of tiles on the right side + // Do rounding later to preserve accuracy + newRect.width = ((this.screenRectangle.width + this.screenRectangle.x) + - (rectangle.x + rectangle.width)) + / (this.tiles.length - (tileIndex + 1)); for(i = tileIndex + 1; i < this.tiles.length; i++){ var rect = this.tiles[i].rectangle; - rect.x = newRect.x + newRect.width * i; + rect.x = (rectangle.x + rectangle.width) + Math.floor(newRect.width * (i - 2)); rect.width = newRect.width; this.tiles[i].rectangle = rect; } -- GitLab