From 1a95ad62b1abcc7f368c6268ca062f6d6239ff1d Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Wed, 23 Apr 2014 19:39:54 -0700 Subject: [PATCH] GUAC-640: Start min zoom at the default zoom of the guac client (100%). If already zoomed out to minimum, stay at minumum through resize. --- guacamole/src/main/webapp/scripts/client-ui.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index adafd5bd4..0989275f3 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -225,7 +225,7 @@ GuacUI.Client = { "expected_input_width" : 1, "expected_input_height" : 1, - "min_zoom" : 0, + "min_zoom" : 1, "max_zoom" : 3, "connectionName" : "Guacamole", @@ -773,16 +773,18 @@ GuacUI.Client.updateDisplayScale = function() { // Currently attacched client var guac = GuacUI.Client.attachedClient; - var adjusted_scale = 1 / (window.devicePixelRatio || 1); // Calculate scale to fit screen - GuacUI.Client.min_zoom = Math.min( + var min_zoom = Math.min( window.innerWidth / guac.getWidth(), window.innerHeight / guac.getHeight() ); - if (guac.getScale() < GuacUI.Client.min_zoom) - guac.scale(GuacUI.Client.min_zoom); + // Clamp scale to minimum zoom level, keep at minimum zoom if at minimum zoom before + if (guac.getScale() < min_zoom || guac.getScale() === GuacUI.Client.min_zoom) + guac.scale(min_zoom); + + GuacUI.Client.min_zoom = min_zoom; };