diff options
author | Pierre Ossman <ossman@cendio.se> | 2022-10-13 10:34:19 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2022-12-27 12:50:57 +0100 |
commit | 7f4a9eebc865a627407e69f22a5de18454cde6df (patch) | |
tree | ddff5ae74529f51fcb915cbdc25da3cb8beec67f /core | |
parent | f172633715adc9721e552f58ea2e117ac1ade3ea (diff) | |
download | novnc-7f4a9eebc865a627407e69f22a5de18454cde6df.tar.gz |
Export clipping state externally
So that UI can reflect if it is currently possible to drag the viewport
or not.
Diffstat (limited to 'core')
-rw-r--r-- | core/rfb.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/rfb.js b/core/rfb.js index 2ccd61a..6afd7c6 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -287,6 +287,7 @@ export default class RFB extends EventTargetMixin { this._viewOnly = false; this._clipViewport = false; + this._clippingViewport = false; this._scaleViewport = false; this._resizeSession = false; @@ -318,6 +319,16 @@ export default class RFB extends EventTargetMixin { get capabilities() { return this._capabilities; } + get clippingViewport() { return this._clippingViewport; } + _setClippingViewport(on) { + if (on === this._clippingViewport) { + return; + } + this._clippingViewport = on; + this.dispatchEvent(new CustomEvent("clippingviewport", + { detail: this._clippingViewport })); + } + get touchButton() { return 0; } set touchButton(button) { Log.Warn("Using old API!"); } @@ -749,6 +760,10 @@ export default class RFB extends EventTargetMixin { const size = this._screenSize(); this._display.viewportChangeSize(size.w, size.h); this._fixScrollbars(); + this._setClippingViewport(size.w < this._display.width || + size.h < this._display.height); + } else { + this._setClippingViewport(false); } // When changing clipping we might show or hide scrollbars. |