mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-637: Use setScale() only to set display scale. Update auto-fit checkbox from within setScale().
This commit is contained in:
@@ -769,6 +769,28 @@ GuacUI.Client.updateThumbnail = function() {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current display scale to the given value, where 1 is 100% (1:1
|
||||
* pixel ratio). Out-of-range values will be clamped in-range.
|
||||
*
|
||||
* @param {Number} new_scale The new scale to apply
|
||||
*/
|
||||
GuacUI.Client.setScale = function(new_scale) {
|
||||
|
||||
new_scale = Math.max(new_scale, GuacUI.Client.min_zoom);
|
||||
new_scale = Math.min(new_scale, GuacUI.Client.max_zoom);
|
||||
|
||||
if (GuacUI.Client.attachedClient)
|
||||
GuacUI.Client.attachedClient.scale(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;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the scale of the attached Guacamole.Client based on current window
|
||||
* size and "auto-fit" setting.
|
||||
@@ -786,25 +808,12 @@ GuacUI.Client.updateDisplayScale = function() {
|
||||
|
||||
// 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.zoom_state.textContent = Math.round(min_zoom * 100) + "%";
|
||||
GuacUI.Client.min_zoom = min_zoom;
|
||||
GuacUI.Client.setScale(min_zoom);
|
||||
}
|
||||
else
|
||||
GuacUI.Client.min_zoom = min_zoom;
|
||||
|
||||
GuacUI.Client.min_zoom = min_zoom;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the current display scale to the given value, where 1 is 100% (1:1
|
||||
* pixel ratio). Out-of-range values will be clamped in-range.
|
||||
*
|
||||
* @param {Number} new_scale The new scale to apply
|
||||
*/
|
||||
GuacUI.Client.setScale = function(new_scale) {
|
||||
new_scale = Math.max(new_scale, GuacUI.Client.min_zoom);
|
||||
new_scale = Math.min(new_scale, GuacUI.Client.max_zoom);
|
||||
guac.scale(new_scale);
|
||||
GuacUI.Client.zoom_state.textContent = Math.round(new_scale * 100) + "%";
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user