// Check if viewport drag is possible. It is only possible
// if the remote display is clipping the client display.
- if (UI.rfb.viewport &&
- UI.rfb.clippingDisplay()) {
+ if (UI.rfb.viewport && UI.rfb.isClipped) {
clipping = true;
}
return this._fb_height;
},
+ get isClipped() {
+ var vp = this._viewportLoc;
+ return this._fb_width > vp.w || this._fb_height > vp.h;
+ },
+
logo: null,
// ===== EVENT HANDLERS =====
this._target.style.cursor = "none";
},
- clippingDisplay: function () {
- var vp = this._viewportLoc;
- return this._fb_width > vp.w || this._fb_height > vp.h;
- },
-
autoscale: function (containerWidth, containerHeight, downscaleOnly) {
var vp = this._viewportLoc;
var targetAspectRatio = containerWidth / containerHeight;
get viewport() { return this._display.viewport; },
set viewport(viewport) { this._display.viewport = viewport; },
+ get isClipped() { return this._display.isClipped; },
+
// ===== EVENT HANDLERS =====
onupdatestate: function () {}, // onupdatestate(rfb, state, oldstate): connection state change
this._display.viewportChangeSize(width, height);
},
- clippingDisplay: function () {
- if (this._rfb_connection_state !== 'connected') { return false; }
- return this._display.clippingDisplay();
- },
-
// Requests a change of remote desktop size. This message is an extension
// and may only be sent if we have received an ExtendedDesktopSize message
requestDesktopSize: function (width, height) {
| viewport | bool | RW | false | Use viewport clipping
| width | int | RO | | Display area width
| height | int | RO | | Display area height
+| isClipped | bool | RO | | Is the remote display is larger than the client display
### 2.3.2 Methods
| changeCursor | (pixels, mask, hotx, hoty, w, h) | Change cursor appearance
| defaultCursor | () | Restore default cursor appearance
| disableLocalCursor | () | Disable local (client-side) cursor
-| clippingDisplay | () | Check if the remote display is larger than the client display
| autoscale | (containerWidth, containerHeight, downscaleOnly) | Scale the display
### 2.3.3 Callbacks
relative position of a clipped canvas. Only relevant if `viewport`
is enabled. Disabled by default.
+`isClipped` *Read only*
+ - Is a `boolean` indicating if the framebuffer is larger than the
+ current canvas, i.e. it is being clipped.
+
`disconnectTimeout`
- Is a `long` indicating how many seconds to wait for a disconnect
request to complete. Is set to `3` by default.
[`RFB.autoscale()`](#rfbautoscale)
- Set `RFB.scale` so that the framebuffer fits a specified container.
-[`RFB.clippingDisplay()`](#rfbclippingDisplay)
- - Returns `true` if the framebuffer is larger than what is currently
- displayed on the canvas.
-
[`RFB.requestDesktopSize()`](#rfbrequestDesktopSize)
- Send a request to change the remote desktop size.
**`downscaleOnly`**
- A `boolean` specifying if the scale must be kept below `1.0`.
-#### RFB.clippingDisplay()
-
-The `RFB.clippingDisplay()` method is used to determine if the
-framebuffer is larger than the current canvas, i.e. it is being
-clipped.
-
-##### Syntax
-
- RFB.clippingDisplay( );
-
-###### Return value
-
-Returns a `boolean` indicating if the framebuffer is currently being
-clipped.
-
#### RFB.requestDesktopSize()
The `RFB.requestDesktopSize()` method is used to request a change of
});
it('should report clipping when framebuffer > viewport', function () {
- var clipping = display.clippingDisplay();
- expect(clipping).to.be.true;
+ expect(display.isClipped).to.be.true;
});
it('should report not clipping when framebuffer = viewport', function () {
display.viewportChangeSize(5, 5);
- var clipping = display.clippingDisplay();
- expect(clipping).to.be.false;
+ expect(display.isClipped).to.be.false;
});
it('should show the entire framebuffer when disabling the viewport', function() {