mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-637: Implement zoom in/out. Fix auto-fit checkbox logic.
This commit is contained in:
@@ -785,9 +785,8 @@ 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 implicitly enabled at minimum zoom level
|
// Auto-fit is enabled iff minimum zoom level
|
||||||
if (new_scale === GuacUI.Client.min_zoom)
|
GuacUI.Client.auto_fit.checked = (new_scale === GuacUI.Client.min_zoom);
|
||||||
GuacUI.Client.auto_fit.checked = true;
|
|
||||||
|
|
||||||
// Disable auto-fit if zoom is required
|
// Disable auto-fit if zoom is required
|
||||||
GuacUI.Client.auto_fit.disabled = (GuacUI.Client.min_zoom >= 1);
|
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
|
// Prevent default on all touch events
|
||||||
document.addEventListener("touchstart", function(e) {
|
document.addEventListener("touchstart", function(e) {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user