Show local (grab/grabbing) cursor while dragging the viewport

This commit is contained in:
Daniel Hammerschmidt 2025-09-15 21:49:58 +02:00
parent 355dd27a45
commit 0f48f31e08
1 changed files with 8 additions and 1 deletions

View File

@ -345,6 +345,7 @@ export default class RFB extends EventTargetMixin {
get dragViewport() { return this._dragViewport; }
set dragViewport(dragViewport) {
this._dragViewport = dragViewport;
this._refreshCursor();
}
get scaleViewport() { return this._scaleViewport; }
@ -1121,6 +1122,7 @@ export default class RFB extends EventTargetMixin {
case 'mousedown':
case 'mouseup':
if (this._dragViewport) {
this._cursor.setLocalCursor(down ? 'grabbing' : 'grab');
if (down && !this._viewportDragging) {
this._viewportDragging = true;
this._viewportDragPos = {'x': pos.x, 'y': pos.y};
@ -3037,7 +3039,7 @@ export default class RFB extends EventTargetMixin {
_shouldShowDotCursor() {
// Called when this._cursorImage is updated
if (!this._showDotCursor) {
if (!this._showDotCursor || this._dragViewport) {
// User does not want to see the dot, so...
return false;
}
@ -3067,6 +3069,11 @@ export default class RFB extends EventTargetMixin {
image.hotx, image.hoty,
image.w, image.h
);
if (this._dragViewport) {
this._cursor.setLocalCursor(this._viewportDragging ? 'grabbing' : 'grab');
} else {
this._cursor.setLocalCursor('none');
}
}
static genDES(password, challenge) {