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:
parent
8d1f0a3de8
commit
002907d2ce
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ The `RFB.autoscale()` method is used to automatically adjust
|
|||
|
||||
##### Syntax
|
||||
|
||||
RFB.autoscale( width, height, downscaleOnly );
|
||||
RFB.autoscale( width, height );
|
||||
|
||||
###### Parameters
|
||||
|
||||
|
@ -420,9 +420,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
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in New Issue