diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-10-20 13:23:03 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-11-01 09:24:28 +0100 |
commit | 07228049ab2f24a7877c12572353a810ab1ef2af (patch) | |
tree | 93e98ce057f0b4f17aca2bafdd7932fab16ef8c7 | |
parent | 5afcec5cba26d4679b271cc5684c9a05e19743aa (diff) | |
download | novnc-07228049ab2f24a7877c12572353a810ab1ef2af.tar.gz |
Remove "downscale only" mode
The normal scaling mode should be sufficient for most use cases, so
let's keep the interface simple.
-rw-r--r-- | app/ui.js | 9 | ||||
-rw-r--r-- | core/display.js | 6 | ||||
-rw-r--r-- | core/rfb.js | 4 | ||||
-rw-r--r-- | docs/API-internal.md | 2 | ||||
-rw-r--r-- | docs/API.md | 5 | ||||
-rw-r--r-- | tests/test.display.js | 14 | ||||
-rw-r--r-- | vnc.html | 1 |
7 files changed, 9 insertions, 32 deletions
@@ -1240,7 +1240,7 @@ var UI = { if (!UI.rfb) return; var resizeMode = UI.getSetting('resize'); - if (resizeMode !== 'scale' && resizeMode !== 'downscale') { + if (resizeMode !== 'scale') { return; } @@ -1250,8 +1250,7 @@ var UI = { return; } - var downscaleOnly = resizeMode === 'downscale'; - UI.rfb.autoscale(screen.w, screen.h, downscaleOnly); + UI.rfb.autoscale(screen.w, screen.h); UI.fixScrollbars(); }, @@ -1294,7 +1293,7 @@ var UI = { var new_clip = UI.getSetting('view_clip'); var resizeSetting = UI.getSetting('resize'); - if (resizeSetting === 'downscale' || resizeSetting === 'scale') { + if (resizeSetting === 'scale') { // Disable viewport clipping if we are scaling new_clip = false; } else if (isTouchDevice) { @@ -1324,7 +1323,7 @@ var UI = { enableDisableViewClip: function() { var resizeSetting = UI.getSetting('resize'); // Disable clipping if we are scaling, connected or on touch - if (resizeSetting === 'downscale' || resizeSetting === 'scale' || + if (resizeSetting === 'scale' || isTouchDevice) { UI.disableSetting('view_clip'); } else { diff --git a/core/display.js b/core/display.js index 87b385a..e61802a 100644 --- a/core/display.js +++ b/core/display.js @@ -517,7 +517,7 @@ Display.prototype = { this._target.style.cursor = "none"; }, - autoscale: function (containerWidth, containerHeight, downscaleOnly) { + autoscale: function (containerWidth, containerHeight) { var vp = this._viewportLoc; var targetAspectRatio = containerWidth / containerHeight; var fbAspectRatio = vp.w / vp.h; @@ -529,10 +529,6 @@ Display.prototype = { scaleRatio = containerHeight / vp.h; } - if (scaleRatio > 1.0 && downscaleOnly) { - scaleRatio = 1.0; - } - this._rescale(scaleRatio); }, diff --git a/core/rfb.js b/core/rfb.js index d2b5932..bd36bdf 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -351,9 +351,9 @@ RFB.prototype = { RFB.messages.clientCutText(this._sock, text); }, - autoscale: function (width, height, downscaleOnly) { + autoscale: function (width, height) { if (this._rfb_connection_state !== 'connected') { return; } - this._display.autoscale(width, height, downscaleOnly); + this._display.autoscale(width, height); }, viewportChangeSize: function(width, height) { diff --git a/docs/API-internal.md b/docs/API-internal.md index 252b786..f030dc3 100644 --- a/docs/API-internal.md +++ b/docs/API-internal.md @@ -117,7 +117,7 @@ None | changeCursor | (pixels, mask, hotx, hoty, w, h) | Change cursor appearance | defaultCursor | () | Restore default cursor appearance | disableLocalCursor | () | Disable local (client-side) cursor -| autoscale | (containerWidth, containerHeight, downscaleOnly) | Scale the display +| autoscale | (containerWidth, containerHeight) | Scale the display ### 2.3.3 Callbacks diff --git a/docs/API.md b/docs/API.md index dedea87..c78f820 100644 --- a/docs/API.md +++ b/docs/API.md @@ -409,7 +409,7 @@ The `RFB.autoscale()` method is used to automatically adjust ##### Syntax - RFB.autoscale( width, height, downscaleOnly ); + RFB.autoscale( width, height ); ###### Parameters @@ -419,9 +419,6 @@ The `RFB.autoscale()` method is used to automatically adjust **`height`** - 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() The `RFB.requestDesktopSize()` method is used to request a change of diff --git a/tests/test.display.js b/tests/test.display.js index cb2460b..b8e9b51 100644 --- a/tests/test.display.js +++ b/tests/test.display.js @@ -272,20 +272,6 @@ describe('Display/Canvas Helper', function () { expect(canvas.width).to.equal(4); 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 () { @@ -213,7 +213,6 @@ <select id="noVNC_setting_resize" name="vncResize"> <option value="off">None</option> <option value="scale">Local Scaling</option> - <option value="downscale">Local Downscaling</option> <option value="remote">Remote Resizing</option> </select> </li> |