From f66a0bad2e040509398e1eb0c21ccd5608a7daee Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 24 Apr 2014 12:42:10 -0700 Subject: [PATCH] GUAC-637: Implement zoom in/out. Fix auto-fit checkbox logic. --- .../src/main/webapp/scripts/client-ui.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index 92b5d7df1..9c1879df6 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -785,9 +785,8 @@ GuacUI.Client.setScale = function(new_scale) { GuacUI.Client.zoom_state.textContent = Math.round(new_scale * 100) + "%"; - // Auto-fit is implicitly enabled at minimum zoom level - if (new_scale === GuacUI.Client.min_zoom) - GuacUI.Client.auto_fit.checked = true; + // Auto-fit is enabled iff minimum zoom level + GuacUI.Client.auto_fit.checked = (new_scale === GuacUI.Client.min_zoom); // Disable auto-fit if zoom is required GuacUI.Client.auto_fit.disabled = (GuacUI.Client.min_zoom >= 1); @@ -2024,6 +2023,24 @@ GuacUI.Client.attach = function(guac) { }; + GuacUI.Client.zoom_in.onclick = function() { + + // Zoom in by 10% + var guac = GuacUI.Client.attachedClient; + if (guac) + GuacUI.Client.setScale(guac.getScale() + 0.1); + + }; + + GuacUI.Client.zoom_out.onclick = function() { + + // Zoom out by 10% + var guac = GuacUI.Client.attachedClient; + if (guac) + GuacUI.Client.setScale(guac.getScale() - 0.1); + + }; + // Prevent default on all touch events document.addEventListener("touchstart", function(e) {