allow drag of in-session windows to seamlessly move accross local browser windows.

This commit is contained in:
matt 2023-12-15 20:14:35 +00:00
parent 9fbea8cd83
commit db2addddce
4 changed files with 23 additions and 4 deletions

View File

@ -25,8 +25,8 @@ window.updateSetting = (name, value) => {
} }
} }
import "core-js/stable"; //import "core-js/stable";
import "regenerator-runtime/runtime"; //import "regenerator-runtime/runtime";
import * as Log from '../core/util/logging.js'; import * as Log from '../core/util/logging.js';
import _, { l10n } from './localization.js'; import _, { l10n } from './localization.js';
import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock } import { isTouchDevice, isSafari, hasScrollbarGutter, dragThreshold, supportsBinaryClipboard, isFirefox, isWindows, isIOS, supportsPointerLock }

View File

@ -1935,6 +1935,9 @@ export default class RFB extends EventTargetMixin {
false, xvncButtonToMask(mappedButton)); false, xvncButtonToMask(mappedButton));
break; break;
case 'mousemove': case 'mousemove':
//when there are multiple screens
//This window can get mouse move events when the cursor is outside of the window, if the mouse is down
//when the cursor crosses the threshold of the window
this._handleMouseMove(pos.x, pos.y); this._handleMouseMove(pos.x, pos.y);
break; break;
} }

View File

@ -28,5 +28,21 @@ export function clientToElement(x, y, elem) {
} else { } else {
pos.y = y - bounds.top; pos.y = y - bounds.top;
} }
//multiple KasmVNC screens, Window can still receive mouse events when cursor goes
//outside of the window if the mouse is down while the moving occurs
if (x > window.innerWidth) {
pos.x += (x - window.innerWidth);
}
else if (x < 0) {
pos.x = x + bounds.left;
}
if (y > window.innerHeight) {
pos.y += (y - window.innerHeight);
}
else if (y < 0) {
pos.y = y + bounds.top;
}
return pos; return pos;
} }

View File

@ -50,7 +50,7 @@
<script src="vendor/interact.min.js"></script> <script src="vendor/interact.min.js"></script>
<!-- Stylesheets --> <!-- Stylesheets -->
<!--link rel="stylesheet" href="app/styles/base.css"> <link rel="stylesheet" href="app/styles/base.css">
<script src="app/error-handler.js"></script> <script src="app/error-handler.js"></script>
@ -63,7 +63,7 @@
} }
</script> </script>
<script type="module" crossorigin="use-credentials" src="app/ui.js"></script--> <script type="module" crossorigin="use-credentials" src="app/ui.js"></script>
</head> </head>
<body> <body>