diff options
Diffstat (limited to 'web/share')
-rw-r--r-- | web/share/js/kvm/mouse.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 8674adf5..961750c2 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -88,6 +88,7 @@ export function Mouse(record_callback) { if (__absolute && !state.absolute) { __relative_deltas = []; } + tools.featureSetEnabled($("mouse-squash"), !state.absolute); __absolute = state.absolute; __updateOnlineLeds(); }; @@ -136,6 +137,10 @@ export function Mouse(record_callback) { return (document.pointerLockElement === $("stream-box")); }; + var __isRelativeSquashed = function() { + return $("mouse-squash-checkbox").checked; + }; + var __relativeCapturedHandler = function() { tools.info("Relative mouse", (__isRelativeCaptured() ? "captured" : "released"), "by pointer lock"); __updateOnlineLeds(); @@ -183,7 +188,12 @@ export function Mouse(record_callback) { x: Math.min(Math.max(-127, event.movementX), 127), y: Math.min(Math.max(-127, event.movementY), 127), }; - __relative_deltas.push(delta); + if (__isRelativeSquashed()) { + __relative_deltas.push(delta); + } else { + tools.debug("Mouse: relative:", delta); + __sendEvent("mouse_relative", {"delta": delta}); + } } }; |