mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-02-18 03:10:47 +01:00
Rename document.capturedElem to captureElement
To better fit most naming.
This commit is contained in:
parent
a8699ab8cb
commit
6067290169
@ -233,7 +233,7 @@ export default class Cursor {
|
|||||||
// When the cursor target has capture we want to show the cursor.
|
// When the cursor target has capture we want to show the cursor.
|
||||||
// So, if a capture is active - look at the captured element instead.
|
// So, if a capture is active - look at the captured element instead.
|
||||||
if (this._captureIsActive()) {
|
if (this._captureIsActive()) {
|
||||||
target = document.capturedElem;
|
target = document.captureElement;
|
||||||
}
|
}
|
||||||
if (this._shouldShowCursor(target)) {
|
if (this._shouldShowCursor(target)) {
|
||||||
this._showCursor();
|
this._showCursor();
|
||||||
@ -248,7 +248,7 @@ export default class Cursor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_captureIsActive() {
|
_captureIsActive() {
|
||||||
return document.capturedElem &&
|
return document.captureElement &&
|
||||||
document.documentElement.contains(document.capturedElem);
|
document.documentElement.contains(document.captureElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ export function stopEvent(e) {
|
|||||||
// Emulate Element.setCapture() when not supported
|
// Emulate Element.setCapture() when not supported
|
||||||
let _captureRecursion = false;
|
let _captureRecursion = false;
|
||||||
let _elementForUnflushedEvents = null;
|
let _elementForUnflushedEvents = null;
|
||||||
document.capturedElem = null;
|
document.captureElement = null;
|
||||||
function _captureProxy(e) {
|
function _captureProxy(e) {
|
||||||
// Recursion protection as we'll see our own event
|
// Recursion protection as we'll see our own event
|
||||||
if (_captureRecursion) return;
|
if (_captureRecursion) return;
|
||||||
@ -31,8 +31,8 @@ function _captureProxy(e) {
|
|||||||
const newEv = new e.constructor(e.type, e);
|
const newEv = new e.constructor(e.type, e);
|
||||||
|
|
||||||
_captureRecursion = true;
|
_captureRecursion = true;
|
||||||
if (document.capturedElem) {
|
if (document.captureElement) {
|
||||||
document.capturedElem.dispatchEvent(newEv);
|
document.captureElement.dispatchEvent(newEv);
|
||||||
} else {
|
} else {
|
||||||
_elementForUnflushedEvents.dispatchEvent(newEv);
|
_elementForUnflushedEvents.dispatchEvent(newEv);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ function _captureProxy(e) {
|
|||||||
// Follow cursor style of target element
|
// Follow cursor style of target element
|
||||||
function _capturedElemChanged() {
|
function _capturedElemChanged() {
|
||||||
const proxyElem = document.getElementById("noVNC_mouse_capture_elem");
|
const proxyElem = document.getElementById("noVNC_mouse_capture_elem");
|
||||||
proxyElem.style.cursor = window.getComputedStyle(document.capturedElem).cursor;
|
proxyElem.style.cursor = window.getComputedStyle(document.captureElement).cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _captureObserver = new MutationObserver(_capturedElemChanged);
|
const _captureObserver = new MutationObserver(_capturedElemChanged);
|
||||||
@ -64,7 +64,7 @@ export function setCapture(target) {
|
|||||||
if (target.setCapture) {
|
if (target.setCapture) {
|
||||||
|
|
||||||
target.setCapture();
|
target.setCapture();
|
||||||
document.capturedElem = target;
|
document.captureElement = target;
|
||||||
|
|
||||||
// IE releases capture on 'click' events which might not trigger
|
// IE releases capture on 'click' events which might not trigger
|
||||||
target.addEventListener('mouseup', releaseCapture);
|
target.addEventListener('mouseup', releaseCapture);
|
||||||
@ -96,7 +96,7 @@ export function setCapture(target) {
|
|||||||
proxyElem.addEventListener('mouseup', _captureProxy);
|
proxyElem.addEventListener('mouseup', _captureProxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.capturedElem = target;
|
document.captureElement = target;
|
||||||
|
|
||||||
// Track cursor and get initial cursor
|
// Track cursor and get initial cursor
|
||||||
_captureObserver.observe(target, {attributes: true});
|
_captureObserver.observe(target, {attributes: true});
|
||||||
@ -115,10 +115,10 @@ export function releaseCapture() {
|
|||||||
if (document.releaseCapture) {
|
if (document.releaseCapture) {
|
||||||
|
|
||||||
document.releaseCapture();
|
document.releaseCapture();
|
||||||
document.capturedElem = null;
|
document.captureElement = null;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!document.capturedElem) {
|
if (!document.captureElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ export function releaseCapture() {
|
|||||||
//
|
//
|
||||||
// Before removing the capturedElem pointer we save it to a
|
// Before removing the capturedElem pointer we save it to a
|
||||||
// temporary variable that the unflushed events can use.
|
// temporary variable that the unflushed events can use.
|
||||||
_elementForUnflushedEvents = document.capturedElem;
|
_elementForUnflushedEvents = document.captureElement;
|
||||||
document.capturedElem = null;
|
document.captureElement = null;
|
||||||
|
|
||||||
_captureObserver.disconnect();
|
_captureObserver.disconnect();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user