Merge 4549101563 into 98c1275d80
This commit is contained in:
commit
37b669d8fc
|
|
@ -113,6 +113,9 @@ start: function(callback) {
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
//UI.initSetting('fullsize',false);
|
||||||
|
UI.initSetting('scale',true);
|
||||||
|
|
||||||
// Show mouse selector buttons on touch screen devices
|
// Show mouse selector buttons on touch screen devices
|
||||||
if (UI.isTouchDevice) {
|
if (UI.isTouchDevice) {
|
||||||
// Show mobile buttons
|
// Show mobile buttons
|
||||||
|
|
@ -120,6 +123,7 @@ start: function(callback) {
|
||||||
UI.setMouseButton();
|
UI.setMouseButton();
|
||||||
// Remove the address bar
|
// Remove the address bar
|
||||||
setTimeout(function() { window.scrollTo(0, 1); }, 100);
|
setTimeout(function() { window.scrollTo(0, 1); }, 100);
|
||||||
|
if(!UI.getSetting('scale'))// && !UI.getSetting('fullsize'))
|
||||||
UI.forceSetting('clip', true);
|
UI.forceSetting('clip', true);
|
||||||
$D('noVNC_clip').disabled = true;
|
$D('noVNC_clip').disabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -209,7 +213,7 @@ addMouseHandlers: function() {
|
||||||
getSetting: function(name) {
|
getSetting: function(name) {
|
||||||
var val, ctrl = $D('noVNC_' + name);
|
var val, ctrl = $D('noVNC_' + name);
|
||||||
val = WebUtil.readSetting(name);
|
val = WebUtil.readSetting(name);
|
||||||
if (val !== null && ctrl.type === 'checkbox') {
|
if (val !== null && (ctrl.type === 'checkbox' || ctrl.type === 'radio')) {
|
||||||
if (val.toString().toLowerCase() in {'0':1, 'no':1, 'false':1}) {
|
if (val.toString().toLowerCase() in {'0':1, 'no':1, 'false':1}) {
|
||||||
val = false;
|
val = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -228,13 +232,10 @@ updateSetting: function(name, value) {
|
||||||
if (typeof value !== 'undefined') {
|
if (typeof value !== 'undefined') {
|
||||||
WebUtil.writeSetting(name, value);
|
WebUtil.writeSetting(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the settings control
|
// Update the settings control
|
||||||
value = UI.getSetting(name);
|
value = UI.getSetting(name);
|
||||||
|
if (ctrl.type === 'checkbox' || ctrl.type === 'radio') {
|
||||||
if (ctrl.type === 'checkbox') {
|
|
||||||
ctrl.checked = value;
|
ctrl.checked = value;
|
||||||
|
|
||||||
} else if (typeof ctrl.options !== 'undefined') {
|
} else if (typeof ctrl.options !== 'undefined') {
|
||||||
for (i = 0; i < ctrl.options.length; i += 1) {
|
for (i = 0; i < ctrl.options.length; i += 1) {
|
||||||
if (ctrl.options[i].value === value) {
|
if (ctrl.options[i].value === value) {
|
||||||
|
|
@ -255,7 +256,7 @@ updateSetting: function(name, value) {
|
||||||
// Save control setting to cookie
|
// Save control setting to cookie
|
||||||
saveSetting: function(name) {
|
saveSetting: function(name) {
|
||||||
var val, ctrl = $D('noVNC_' + name);
|
var val, ctrl = $D('noVNC_' + name);
|
||||||
if (ctrl.type === 'checkbox') {
|
if (ctrl.type === 'checkbox' || ctrl.type === 'radio') {
|
||||||
val = ctrl.checked;
|
val = ctrl.checked;
|
||||||
} else if (typeof ctrl.options !== 'undefined') {
|
} else if (typeof ctrl.options !== 'undefined') {
|
||||||
val = ctrl.options[ctrl.selectedIndex].value;
|
val = ctrl.options[ctrl.selectedIndex].value;
|
||||||
|
|
@ -385,6 +386,8 @@ toggleSettingsPanel: function() {
|
||||||
UI.updateSetting('cursor', !UI.isTouchDevice);
|
UI.updateSetting('cursor', !UI.isTouchDevice);
|
||||||
$D('noVNC_cursor').disabled = true;
|
$D('noVNC_cursor').disabled = true;
|
||||||
}
|
}
|
||||||
|
//UI.updateSetting('fullsize');
|
||||||
|
UI.updateSetting('scale');
|
||||||
UI.updateSetting('clip');
|
UI.updateSetting('clip');
|
||||||
UI.updateSetting('shared');
|
UI.updateSetting('shared');
|
||||||
UI.updateSetting('view_only');
|
UI.updateSetting('view_only');
|
||||||
|
|
@ -434,6 +437,8 @@ settingsApply: function() {
|
||||||
if (UI.rfb.get_display().get_cursor_uri()) {
|
if (UI.rfb.get_display().get_cursor_uri()) {
|
||||||
UI.saveSetting('cursor');
|
UI.saveSetting('cursor');
|
||||||
}
|
}
|
||||||
|
//UI.saveSetting('fullsize');
|
||||||
|
UI.saveSetting('scale');
|
||||||
UI.saveSetting('clip');
|
UI.saveSetting('clip');
|
||||||
UI.saveSetting('shared');
|
UI.saveSetting('shared');
|
||||||
UI.saveSetting('view_only');
|
UI.saveSetting('view_only');
|
||||||
|
|
@ -663,6 +668,30 @@ clipSend: function() {
|
||||||
Util.Debug("<< UI.clipSend");
|
Util.Debug("<< UI.clipSend");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
scale: function() {
|
||||||
|
var my_width = window.innerWidth-5;
|
||||||
|
var my_height = window.innerHeight-5;
|
||||||
|
|
||||||
|
if($D('noVNC-control-bar')!=null) {
|
||||||
|
my_height -= 36; //CSS height value of 'noVNC-control-bar'
|
||||||
|
}
|
||||||
|
|
||||||
|
var display = UI.rfb.get_display();
|
||||||
|
var fbratio = display.get_width() / display.get_height();
|
||||||
|
var myratio = my_width / my_height;
|
||||||
|
|
||||||
|
if(fbratio>=myratio) {
|
||||||
|
UI.rfb.get_mouse().set_scale(my_width/display.get_width());
|
||||||
|
$D('noVNC_canvas').style.width = my_width + "px";
|
||||||
|
$D('noVNC_canvas').style.height = (my_width/fbratio) + "px";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UI.rfb.get_mouse().set_scale(my_height/display.get_height());
|
||||||
|
$D('noVNC_canvas').style.width = (my_height*fbratio) + "px";
|
||||||
|
$D('noVNC_canvas').style.height = my_height + "px";
|
||||||
|
}
|
||||||
|
Util.Debug("SetScale: "+UI.rfb.get_mouse().get_scale());
|
||||||
|
},
|
||||||
|
|
||||||
// Enable/disable and configure viewport clipping
|
// Enable/disable and configure viewport clipping
|
||||||
setViewClip: function(clip) {
|
setViewClip: function(clip) {
|
||||||
|
|
@ -700,6 +729,9 @@ setViewClip: function(clip) {
|
||||||
display.set_viewport(true);
|
display.set_viewport(true);
|
||||||
display.viewportChange(0, 0, new_w, new_h);
|
display.viewportChange(0, 0, new_w, new_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(UI.getSetting('scale'))
|
||||||
|
UI.scale();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Toggle/set/unset the viewport drag/move button
|
// Toggle/set/unset the viewport drag/move button
|
||||||
|
|
|
||||||
7
vnc.html
7
vnc.html
|
|
@ -145,9 +145,14 @@
|
||||||
<li><input id="noVNC_encrypt" type="checkbox"> Encrypt</li>
|
<li><input id="noVNC_encrypt" type="checkbox"> Encrypt</li>
|
||||||
<li><input id="noVNC_true_color" type="checkbox" checked> True Color</li>
|
<li><input id="noVNC_true_color" type="checkbox" checked> True Color</li>
|
||||||
<li><input id="noVNC_cursor" type="checkbox"> Local Cursor</li>
|
<li><input id="noVNC_cursor" type="checkbox"> Local Cursor</li>
|
||||||
<li><input id="noVNC_clip" type="checkbox"> Clip to Window</li>
|
|
||||||
<li><input id="noVNC_shared" type="checkbox"> Shared Mode</li>
|
<li><input id="noVNC_shared" type="checkbox"> Shared Mode</li>
|
||||||
<li><input id="noVNC_view_only" type="checkbox"> View Only</li>
|
<li><input id="noVNC_view_only" type="checkbox"> View Only</li>
|
||||||
|
<li> </li>
|
||||||
|
<li> Resize using:</li>
|
||||||
|
<!--li><input id="noVNC_fullsize" name="noVNC_clip" type="radio" value="true"> Fullsize</li-->
|
||||||
|
<li><input id="noVNC_clip" name="noVNC_clip" type="radio" value="true"> Clip to Window</li>
|
||||||
|
<li><input id="noVNC_scale" name="noVNC_clip" type="radio" value="true" checked="checked"> Scale to Window</li>
|
||||||
|
<li> </li>
|
||||||
<li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li>
|
<li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li>
|
||||||
<li><input id="noVNC_path" type="input" value="websockify"> Path</li>
|
<li><input id="noVNC_path" type="input" value="websockify"> Path</li>
|
||||||
<li><input id="noVNC_repeaterID" type="input" value=""> Repeater ID</li>
|
<li><input id="noVNC_repeaterID" type="input" value=""> Repeater ID</li>
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@
|
||||||
'true_color': WebUtil.getQueryVar('true_color', true),
|
'true_color': WebUtil.getQueryVar('true_color', true),
|
||||||
'local_cursor': WebUtil.getQueryVar('cursor', true),
|
'local_cursor': WebUtil.getQueryVar('cursor', true),
|
||||||
'shared': WebUtil.getQueryVar('shared', true),
|
'shared': WebUtil.getQueryVar('shared', true),
|
||||||
|
'scale': WebUtil.getQueryVar('scale', true),
|
||||||
'view_only': WebUtil.getQueryVar('view_only', false),
|
'view_only': WebUtil.getQueryVar('view_only', false),
|
||||||
'updateState': updateState,
|
'updateState': updateState,
|
||||||
'onPasswordRequired': passwordRequired});
|
'onPasswordRequired': passwordRequired});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue