Update interface on view only toggle
Instead of waiting for updateVisualState() to be called in order for the interface to update, we can call it directly in updateViewOnly(). This is a better placement logically as well. Another upside of this is that we can call updateVisualState() earlier on connect, that allows for the "connecting"-throbber to be shown quicker.
This commit is contained in:
parent
b3c0d570bb
commit
f3763a010c
31
app/ui.js
31
app/ui.js
|
@ -438,19 +438,6 @@ var UI = {
|
||||||
UI.keepControlbar();
|
UI.keepControlbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide input related buttons in view only mode
|
|
||||||
if (UI.rfb && UI.rfb.viewOnly) {
|
|
||||||
document.getElementById('noVNC_keyboard_button')
|
|
||||||
.classList.add('noVNC_hidden');
|
|
||||||
document.getElementById('noVNC_toggle_extra_keys_button')
|
|
||||||
.classList.add('noVNC_hidden');
|
|
||||||
} else {
|
|
||||||
document.getElementById('noVNC_keyboard_button')
|
|
||||||
.classList.remove('noVNC_hidden');
|
|
||||||
document.getElementById('noVNC_toggle_extra_keys_button')
|
|
||||||
.classList.remove('noVNC_hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
// State change disables viewport dragging.
|
// State change disables viewport dragging.
|
||||||
// It is enabled (toggled) by direct click on the button
|
// It is enabled (toggled) by direct click on the button
|
||||||
UI.setViewDrag(false);
|
UI.setViewDrag(false);
|
||||||
|
@ -1019,6 +1006,8 @@ var UI = {
|
||||||
UI.closeAllPanels();
|
UI.closeAllPanels();
|
||||||
UI.closeConnectPanel();
|
UI.closeConnectPanel();
|
||||||
|
|
||||||
|
UI.updateVisualState('connecting');
|
||||||
|
|
||||||
var url;
|
var url;
|
||||||
|
|
||||||
url = UI.getSetting('encrypt') ? 'wss' : 'ws';
|
url = UI.getSetting('encrypt') ? 'wss' : 'ws';
|
||||||
|
@ -1045,8 +1034,7 @@ var UI = {
|
||||||
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
|
UI.rfb.scaleViewport = UI.getSetting('resize') === 'scale';
|
||||||
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
|
UI.rfb.resizeSession = UI.getSetting('resize') === 'remote';
|
||||||
|
|
||||||
UI.updateVisualState('connecting');
|
UI.updateViewOnly(); // requires UI.rfb
|
||||||
UI.updateViewOnly();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
disconnect: function() {
|
disconnect: function() {
|
||||||
|
@ -1606,6 +1594,19 @@ var UI = {
|
||||||
updateViewOnly: function() {
|
updateViewOnly: function() {
|
||||||
if (!UI.rfb) return;
|
if (!UI.rfb) return;
|
||||||
UI.rfb.viewOnly = UI.getSetting('view_only');
|
UI.rfb.viewOnly = UI.getSetting('view_only');
|
||||||
|
|
||||||
|
// Hide input related buttons in view only mode
|
||||||
|
if (UI.rfb.viewOnly) {
|
||||||
|
document.getElementById('noVNC_keyboard_button')
|
||||||
|
.classList.add('noVNC_hidden');
|
||||||
|
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||||
|
.classList.add('noVNC_hidden');
|
||||||
|
} else {
|
||||||
|
document.getElementById('noVNC_keyboard_button')
|
||||||
|
.classList.remove('noVNC_hidden');
|
||||||
|
document.getElementById('noVNC_toggle_extra_keys_button')
|
||||||
|
.classList.remove('noVNC_hidden');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLogging: function() {
|
updateLogging: function() {
|
||||||
|
|
Loading…
Reference in New Issue