From ac4afe590bfe70d8ddc350a5a25e351061e1b35c Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 25 Apr 2014 17:05:46 -0700 Subject: [PATCH] GUAC-642: Control display of scroll bars directly. --- .../src/main/webapp/scripts/client-ui.js | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index 408b6aac3..d1ee45215 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -785,11 +785,19 @@ GuacUI.Client.setScale = function(new_scale) { GuacUI.Client.zoom_state.textContent = Math.round(new_scale * 100) + "%"; - // Auto-fit is enabled iff minimum zoom level - GuacUI.Client.auto_fit.checked = (new_scale === GuacUI.Client.min_zoom); + // If at minimum zoom level, auto fit is ON + if (new_scale === GuacUI.Client.min_zoom) { + GuacUI.Client.main.style.overflow = "hidden"; + GuacUI.Client.auto_fit.checked = true; + GuacUI.Client.auto_fit.disabled = (GuacUI.Client.min_zoom >= 1); + } - // Disable auto-fit if zoom is required - GuacUI.Client.auto_fit.disabled = (GuacUI.Client.min_zoom >= 1 && new_scale === GuacUI.Client.min_zoom); + // If at minimum zoom level, auto fit is OFF + else { + GuacUI.Client.main.style.overflow = "auto"; + GuacUI.Client.auto_fit.checked = false; + GuacUI.Client.auto_fit.disabled = false; + } }; @@ -1524,29 +1532,21 @@ GuacUI.Client.attach = function(guac) { * Send size events on resize */ - var resize_timeout = null; - window.onresize = function() { // Remove scrollbars during resize GuacUI.Client.main.style.overflow = "hidden"; - // Wait for resize to settle before updating - window.clearTimeout(resize_timeout); - resize_timeout = window.setTimeout(function() { + var pixel_density = window.devicePixelRatio || 1; + var width = window.innerWidth * pixel_density; + var height = window.innerHeight * pixel_density; - var pixel_density = window.devicePixelRatio || 1; - var width = window.innerWidth * pixel_density; - var height = window.innerHeight * pixel_density; + GuacUI.Client.main.style.overflow = "auto"; - GuacUI.Client.main.style.overflow = "auto"; + if (GuacUI.Client.attachedClient) + GuacUI.Client.attachedClient.sendSize(width, height); - if (GuacUI.Client.attachedClient) - GuacUI.Client.attachedClient.sendSize(width, height); - - GuacUI.Client.updateDisplayScale(); - - }, 10); + GuacUI.Client.updateDisplayScale(); };