mirror of
https://github.com/novnc/noVNC.git
synced 2026-06-04 19:39:39 +00:00
Adjust scaling when session size changes
Session size changes can be initiated from the server, and not just from the client. Make sure we update the scaling when this happens.
This commit is contained in:
28
app/ui.js
28
app/ui.js
@@ -1242,14 +1242,33 @@ var UI = {
|
||||
}
|
||||
}, 500);
|
||||
|
||||
} else if (resizeMode === 'scale' || resizeMode === 'downscale') {
|
||||
var downscaleOnly = resizeMode === 'downscale';
|
||||
display.autoscale(screen.w, screen.h, downscaleOnly);
|
||||
UI.fixScrollbars();
|
||||
} else {
|
||||
UI.updateScaling();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Re-calculate local scaling
|
||||
updateScaling: function() {
|
||||
if (!UI.rfb) return;
|
||||
|
||||
var resizeMode = UI.getSetting('resize');
|
||||
if (resizeMode !== 'scale' && resizeMode !== 'downscale') {
|
||||
return;
|
||||
}
|
||||
|
||||
var screen = UI.screenSize();
|
||||
|
||||
if (!screen || !UI.connected || !UI.rfb.get_display()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var display = UI.rfb.get_display();
|
||||
var downscaleOnly = resizeMode === 'downscale';
|
||||
display.autoscale(screen.w, screen.h, downscaleOnly);
|
||||
UI.fixScrollbars();
|
||||
},
|
||||
|
||||
// Gets the the size of the available viewport in the browser window
|
||||
screenSize: function() {
|
||||
var screen = document.getElementById('noVNC_screen');
|
||||
@@ -1674,6 +1693,7 @@ var UI = {
|
||||
|
||||
updateSessionSize: function(rfb, width, height) {
|
||||
UI.updateViewClip();
|
||||
UI.updateScaling();
|
||||
UI.fixScrollbars();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user