GUAC-642: Control display of scroll bars directly.

This commit is contained in:
Michael Jumper
2014-04-25 17:05:46 -07:00
parent 9c6d78d5d4
commit ac4afe590b

View File

@@ -785,11 +785,19 @@ GuacUI.Client.setScale = function(new_scale) {
GuacUI.Client.zoom_state.textContent = Math.round(new_scale * 100) + "%"; GuacUI.Client.zoom_state.textContent = Math.round(new_scale * 100) + "%";
// Auto-fit is enabled iff minimum zoom level // If at minimum zoom level, auto fit is ON
GuacUI.Client.auto_fit.checked = (new_scale === GuacUI.Client.min_zoom); 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 // If at minimum zoom level, auto fit is OFF
GuacUI.Client.auto_fit.disabled = (GuacUI.Client.min_zoom >= 1 && new_scale === GuacUI.Client.min_zoom); 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 * Send size events on resize
*/ */
var resize_timeout = null;
window.onresize = function() { window.onresize = function() {
// Remove scrollbars during resize // Remove scrollbars during resize
GuacUI.Client.main.style.overflow = "hidden"; GuacUI.Client.main.style.overflow = "hidden";
// Wait for resize to settle before updating var pixel_density = window.devicePixelRatio || 1;
window.clearTimeout(resize_timeout); var width = window.innerWidth * pixel_density;
resize_timeout = window.setTimeout(function() { var height = window.innerHeight * pixel_density;
var pixel_density = window.devicePixelRatio || 1; GuacUI.Client.main.style.overflow = "auto";
var width = window.innerWidth * pixel_density;
var height = window.innerHeight * pixel_density;
GuacUI.Client.main.style.overflow = "auto"; if (GuacUI.Client.attachedClient)
GuacUI.Client.attachedClient.sendSize(width, height);
if (GuacUI.Client.attachedClient) GuacUI.Client.updateDisplayScale();
GuacUI.Client.attachedClient.sendSize(width, height);
GuacUI.Client.updateDisplayScale();
}, 10);
}; };