refactoring

This commit is contained in:
Maxim Devaev
2024-11-02 18:47:59 +02:00
parent 0fd1174bc5
commit 5aef0a2193
6 changed files with 127 additions and 102 deletions

View File

@@ -90,20 +90,20 @@ export function Mouse(__getGeometry, __recordWsEvent) {
__updateOnlineLeds();
};
self.setState = function(state, hid_online, hid_busy) {
self.setState = function(online, absolute, hid_online, hid_busy) {
if (!hid_online) {
__online = null;
} else {
__online = (state.online && !hid_busy);
__online = (online && !hid_busy);
}
if (!__absolute && state.absolute && __isRelativeCaptured()) {
if (!__absolute && absolute && __isRelativeCaptured()) {
document.exitPointerLock();
}
if (__absolute && !state.absolute) {
if (__absolute && !absolute) {
__relative_deltas = [];
__relative_touch_pos = null;
}
__absolute = state.absolute;
__absolute = absolute;
__updateOnlineLeds();
};