GUAC-642: Remove scrollbars before resize. Delay sending of size until after reflow.

This commit is contained in:
Michael Jumper
2014-04-23 15:51:06 -07:00
parent 57e8a57068
commit d48bff62f2

View File

@@ -1475,17 +1475,31 @@ 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
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 pixel_density = window.devicePixelRatio || 1;
var width = window.innerWidth * pixel_density; var width = window.innerWidth * pixel_density;
var height = window.innerHeight * pixel_density; var height = window.innerHeight * pixel_density;
GuacUI.Client.main.style.overflow = "auto";
if (GuacUI.Client.attachedClient) if (GuacUI.Client.attachedClient)
GuacUI.Client.attachedClient.sendSize(width, height); GuacUI.Client.attachedClient.sendSize(width, height);
GuacUI.Client.updateDisplayScale(); GuacUI.Client.updateDisplayScale();
}, 10);
}; };
GuacamoleSessionStorage.addChangeListener(function(name, value) { GuacamoleSessionStorage.addChangeListener(function(name, value) {