diff options
author | Devaev Maxim <[email protected]> | 2020-11-07 05:55:34 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-11-07 05:55:34 +0300 |
commit | b83ba7692ae96a4d1e479f48d5194c697295719a (patch) | |
tree | d5d31bc784bf732d554e152b7468d605b6766cbd /web/share | |
parent | afcd6408bba3852fcfdb8a795e0baa9d8f4d1d7d (diff) |
optional relative squashing
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}); + } } }; |