From 80608425696b9f0a139fb91af3ad40ea8981c676 Mon Sep 17 00:00:00 2001 From: Jeff Nusz Date: Mon, 14 Nov 2016 11:24:29 -0800 Subject: [PATCH] resize immediately, except for browser resize event. Fix #111 --- src/dat/gui/GUI.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dat/gui/GUI.js b/src/dat/gui/GUI.js index 6815d5c..e037111 100644 --- a/src/dat/gui/GUI.js +++ b/src/dat/gui/GUI.js @@ -392,7 +392,7 @@ const GUI = function(pars) { } this.__resizeHandler = function() { - _this.onResize(); + _this.onResizeDebounced(); }; dom.bind(window, 'resize', this.__resizeHandler); @@ -571,7 +571,8 @@ common.extend( this.closed = true; }, - onResize: common.debounce(function() { + + onResize: function() { // we debounce this function to prevent performance issues when rotating on tablet/mobile const root = this.getRoot(); if (root.scrollable) { @@ -602,7 +603,9 @@ common.extend( if (root.__closeButton) { root.__closeButton.style.width = root.width + 'px'; } - }, 200), + }, + + onResizeDebounced: common.debounce(function() { this.onResize(); }, 200), /** * Mark objects for saving. The order of these objects cannot change as