From 5b69223ef8e529aec3b70e6524399b153fabca4f Mon Sep 17 00:00:00 2001 From: Jono Brandel Date: Thu, 10 Feb 2011 12:16:51 -0800 Subject: [PATCH] gui styling adaptation for scrollbars width --- gui.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gui.js b/gui.js index 5de51bf..845b5ae 100644 --- a/gui.js +++ b/gui.js @@ -138,22 +138,14 @@ var GUI = function() { _this.toggle(); - // Clears lingering slider column - _this.domElement.style.width = (width+1)+'px'; - setTimeout(function() { - _this.domElement.style.width = width+'px'; - }, 1); + } if (togglePressed && toggleDragged) { if (dragDisplacementX == 0) { - // Clears lingering slider column - _this.domElement.style.width = (width+1)+'px'; - setTimeout(function() { - _this.domElement.style.width = width+'px'; - }, 1); + adaptToScrollbar() } @@ -420,6 +412,8 @@ var GUI = function() { curControllerContainerHeight += (resizeTo - curControllerContainerHeight)*0.6; if (Math.abs(curControllerContainerHeight-resizeTo) < 1) { curControllerContainerHeight = resizeTo; + adaptToScrollbar(); + } else { resizeTimeout = setTimeout(beginResize, 1000/30); } @@ -427,6 +421,14 @@ var GUI = function() { checkForOverflow(); } + var adaptToScrollbar = function() { + // Clears lingering slider column + _this.domElement.style.width = (width+1)+'px'; + setTimeout(function() { + _this.domElement.style.width = width+'px'; + }, 1); + }; + // Load saved appearance: if (GUI.guiIndex < GUI.savedAppearanceVars.length) {