[go: nahoru, domu]

Skip to content

Commit

Permalink
Clarified enableDisableClip (now called enableDisableViewClip) and
Browse files Browse the repository at this point in the history
moved it to where the other clipping functions are.
  • Loading branch information
samhed committed Jun 25, 2015
1 parent 4f19e5c commit 30bfff8
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions include/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ var UI;

$D("noVNC_resize").onchange = function () {
var connected = UI.rfb && UI.rfb_state === 'normal';
UI.enableDisableClip(connected);
UI.enableDisableViewClip(connected);
};
},

Expand Down Expand Up @@ -685,7 +685,7 @@ var UI;
$D('noVNC_cursor').disabled = true;
}

UI.enableDisableClip(connected);
UI.enableDisableViewClip(connected);
$D('noVNC_resize').disabled = connected;
$D('noVNC_shared').disabled = connected;
$D('noVNC_view_only').disabled = connected;
Expand Down Expand Up @@ -747,19 +747,6 @@ var UI;
}
},

enableDisableClip: function (connected) {
var resizeElem = $D('noVNC_resize');
if (resizeElem.value === 'downscale' || resizeElem.value === 'scale') {
UI.forceSetting('clip', false);
$D('noVNC_clip').disabled = true;
} else {
$D('noVNC_clip').disabled = connected || UI.isTouchDevice;
if (UI.isTouchDevice) {
UI.forceSetting('clip', true);
}
}
},

// This resize can not be done until we know from the first Frame Buffer Update
// if it is supported or not.
// The resize is needed to make sure the server desktop size is updated to the
Expand Down Expand Up @@ -849,7 +836,7 @@ var UI;
Util.Debug("<< UI.clipSend");
},

// Enable/disable and configure viewport clipping
// Set and configure viewport clipping
setViewClip: function(clip) {
var display;
if (UI.rfb) {
Expand Down Expand Up @@ -900,6 +887,20 @@ var UI;
}
},

// Handle special cases where clipping is forced on/off or locked
enableDisableViewClip: function (connected) {
var resizeElem = $D('noVNC_resize');
if (resizeElem.value === 'downscale' || resizeElem.value === 'scale') {
UI.forceSetting('clip', false);
$D('noVNC_clip').disabled = true;
} else {
$D('noVNC_clip').disabled = connected || UI.isTouchDevice;
if (UI.isTouchDevice) {
UI.forceSetting('clip', true);
}
}
},

// Update the viewport drag/move button
updateViewDrag: function(drag) {
if (!UI.rfb) return;
Expand Down

0 comments on commit 30bfff8

Please sign in to comment.