From 758f8ce7507fcfa70ec1952d82f7bb4caf0dbbf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Hedin=20Br=C3=B8nner?= Date: Sun, 26 Aug 2018 18:22:26 +0200 Subject: [PATCH] space.layout: compare against correct width when centering --- tiling.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tiling.js b/tiling.js index 2a33c25..68e5bed 100644 --- a/tiling.js +++ b/tiling.js @@ -263,8 +263,10 @@ class Space extends Array { } this._inLayout = false; - if (x < this.width) { - this.targetX = Math.round((this.width - (x - gap))/2); + let width = x - gap; + this.cloneContainer.width = width; + if (width < this.width) { + this.targetX = Math.round((this.width - width)/2); } if (animate) { Tweener.addTween(this.cloneContainer,