From d2277733c39725cee68790ac9e53e6c8db8e49a0 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 24 Apr 2014 12:38:03 -0700 Subject: [PATCH] GUAC-637: Implement auto-fit checkbox. --- .../src/main/webapp/scripts/client-ui.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index 4a39adb0e..92b5d7df1 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -789,6 +789,9 @@ GuacUI.Client.setScale = function(new_scale) { if (new_scale === GuacUI.Client.min_zoom) GuacUI.Client.auto_fit.checked = true; + // Disable auto-fit if zoom is required + GuacUI.Client.auto_fit.disabled = (GuacUI.Client.min_zoom >= 1); + }; /** @@ -2004,6 +2007,22 @@ GuacUI.Client.attach = function(guac) { }, false); + /* + * Zoom + */ + + GuacUI.Client.auto_fit.onclick = + GuacUI.Client.auto_fit.onchange = function() { + + // If auto-fit enabled, zoom out as far as possible + if (GuacUI.Client.auto_fit.checked) + GuacUI.Client.setScale(0); + + // Otherwise, zoom to 1:1 + else + GuacUI.Client.setScale(1); + + }; // Prevent default on all touch events document.addEventListener("touchstart", function(e) {