Remove "downscale only" mode

The normal scaling mode should be sufficient for most use cases, so
let's keep the interface simple.
This commit is contained in:
Pierre Ossman 2017-10-20 13:23:03 +02:00
parent 8d1f0a3de8
commit 002907d2ce
7 changed files with 9 additions and 32 deletions

View File

@ -1240,7 +1240,7 @@ var UI = {
if (!UI.rfb) return; if (!UI.rfb) return;
var resizeMode = UI.getSetting('resize'); var resizeMode = UI.getSetting('resize');
if (resizeMode !== 'scale' && resizeMode !== 'downscale') { if (resizeMode !== 'scale') {
return; return;
} }
@ -1250,8 +1250,7 @@ var UI = {
return; return;
} }
var downscaleOnly = resizeMode === 'downscale'; UI.rfb.autoscale(screen.w, screen.h);
UI.rfb.autoscale(screen.w, screen.h, downscaleOnly);
UI.fixScrollbars(); UI.fixScrollbars();
}, },
@ -1294,7 +1293,7 @@ var UI = {
var new_clip = UI.getSetting('view_clip'); var new_clip = UI.getSetting('view_clip');
var resizeSetting = UI.getSetting('resize'); var resizeSetting = UI.getSetting('resize');
if (resizeSetting === 'downscale' || resizeSetting === 'scale') { if (resizeSetting === 'scale') {
// Disable viewport clipping if we are scaling // Disable viewport clipping if we are scaling
new_clip = false; new_clip = false;
} else if (isTouchDevice) { } else if (isTouchDevice) {
@ -1324,7 +1323,7 @@ var UI = {
enableDisableViewClip: function() { enableDisableViewClip: function() {
var resizeSetting = UI.getSetting('resize'); var resizeSetting = UI.getSetting('resize');
// Disable clipping if we are scaling, connected or on touch // Disable clipping if we are scaling, connected or on touch
if (resizeSetting === 'downscale' || resizeSetting === 'scale' || if (resizeSetting === 'scale' ||
isTouchDevice) { isTouchDevice) {
UI.disableSetting('view_clip'); UI.disableSetting('view_clip');
} else { } else {

View File

@ -517,7 +517,7 @@ Display.prototype = {
this._target.style.cursor = "none"; this._target.style.cursor = "none";
}, },
autoscale: function (containerWidth, containerHeight, downscaleOnly) { autoscale: function (containerWidth, containerHeight) {
var vp = this._viewportLoc; var vp = this._viewportLoc;
var targetAspectRatio = containerWidth / containerHeight; var targetAspectRatio = containerWidth / containerHeight;
var fbAspectRatio = vp.w / vp.h; var fbAspectRatio = vp.w / vp.h;
@ -529,10 +529,6 @@ Display.prototype = {
scaleRatio = containerHeight / vp.h; scaleRatio = containerHeight / vp.h;
} }
if (scaleRatio > 1.0 && downscaleOnly) {
scaleRatio = 1.0;
}
this._rescale(scaleRatio); this._rescale(scaleRatio);
}, },

View File

@ -351,9 +351,9 @@ RFB.prototype = {
RFB.messages.clientCutText(this._sock, text); RFB.messages.clientCutText(this._sock, text);
}, },
autoscale: function (width, height, downscaleOnly) { autoscale: function (width, height) {
if (this._rfb_connection_state !== 'connected') { return; } if (this._rfb_connection_state !== 'connected') { return; }
this._display.autoscale(width, height, downscaleOnly); this._display.autoscale(width, height);
}, },
viewportChangeSize: function(width, height) { viewportChangeSize: function(width, height) {

View File

@ -117,7 +117,7 @@ None
| changeCursor | (pixels, mask, hotx, hoty, w, h) | Change cursor appearance | changeCursor | (pixels, mask, hotx, hoty, w, h) | Change cursor appearance
| defaultCursor | () | Restore default cursor appearance | defaultCursor | () | Restore default cursor appearance
| disableLocalCursor | () | Disable local (client-side) cursor | disableLocalCursor | () | Disable local (client-side) cursor
| autoscale | (containerWidth, containerHeight, downscaleOnly) | Scale the display | autoscale | (containerWidth, containerHeight) | Scale the display
### 2.3.3 Callbacks ### 2.3.3 Callbacks

View File

@ -410,7 +410,7 @@ The `RFB.autoscale()` method is used to automatically adjust
##### Syntax ##### Syntax
RFB.autoscale( width, height, downscaleOnly ); RFB.autoscale( width, height );
###### Parameters ###### Parameters
@ -420,9 +420,6 @@ The `RFB.autoscale()` method is used to automatically adjust
**`height`** **`height`**
- A `long` specifying the maximum height of the canvas in CSS pixels. - A `long` specifying the maximum height of the canvas in CSS pixels.
**`downscaleOnly`**
- A `boolean` specifying if the scale must be kept below `1.0`.
#### RFB.requestDesktopSize() #### RFB.requestDesktopSize()
The `RFB.requestDesktopSize()` method is used to request a change of The `RFB.requestDesktopSize()` method is used to request a change of

View File

@ -272,20 +272,6 @@ describe('Display/Canvas Helper', function () {
expect(canvas.width).to.equal(4); expect(canvas.width).to.equal(4);
expect(canvas.height).to.equal(3); expect(canvas.height).to.equal(3);
}); });
it('should not upscale when downscaleOnly is true', function () {
display.autoscale(2, 2, true);
expect(display.absX(9)).to.equal(18);
expect(display.absY(18)).to.equal(36);
expect(canvas.clientWidth).to.equal(2);
expect(canvas.clientHeight).to.equal(2);
display.autoscale(16, 9, true);
expect(display.absX(9)).to.equal(9);
expect(display.absY(18)).to.equal(18);
expect(canvas.clientWidth).to.equal(4);
expect(canvas.clientHeight).to.equal(3);
});
}); });
describe('drawing', function () { describe('drawing', function () {

View File

@ -213,7 +213,6 @@
<select id="noVNC_setting_resize" name="vncResize"> <select id="noVNC_setting_resize" name="vncResize">
<option value="off">None</option> <option value="off">None</option>
<option value="scale">Local Scaling</option> <option value="scale">Local Scaling</option>
<option value="downscale">Local Downscaling</option>
<option value="remote">Remote Resizing</option> <option value="remote">Remote Resizing</option>
</select> </select>
</li> </li>