mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 02:21:53 +08:00
optional relative squashing
This commit is contained in:
@@ -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});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user