From be6509e4ee51990bdbe8189a64ffe9792123aa8c Mon Sep 17 00:00:00 2001
From: Fabian Homborg <FHomborg@gmail.com>
Date: Fri, 18 Oct 2013 19:57:50 +0200
Subject: [PATCH] Fix adjusting to panels in bladelayout.

This also seems to already work in spirallayout (props to Matthias), so
now everything should work with panels _everywhere_, but still with restarts.
---
 contents/code/bladelayout.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contents/code/bladelayout.js b/contents/code/bladelayout.js
index 934c552..1026874 100644
--- a/contents/code/bladelayout.js
+++ b/contents/code/bladelayout.js
@@ -88,7 +88,7 @@ BladeLayout.prototype.addTile = function() {
 		}
 		// Adjust tile's width for rounding errors
 		newRect.x = newRect.x + newRect.width * this.tiles.length;
-		newRect.width = this.screenRectangle.width - newRect.x;
+		newRect.width = (this.screenRectangle.width + this.screenRectangle.x) - newRect.x;
 		// TODO: Move this before setting ratio to simplify
         this._createTile(newRect);
     }
@@ -124,7 +124,7 @@ BladeLayout.prototype.removeTile = function(tileIndex) {
 			this.tiles[i].neighbours[Direction.Right] = i + 1;
 		}
 		// Adjust rightmost tile's height for rounding errors
-		this.tiles[this.tiles.length - 1].rectangle.width = this.screenRectangle.width - this.tiles[this.tiles.length - 1].rectangle.x;
+		this.tiles[this.tiles.length - 1].rectangle.width = (this.screenRectangle.width + this.screenRectangle.x) - this.tiles[this.tiles.length - 1].rectangle.x;
     }
 }
 
-- 
GitLab