From 55e67e32ae40c7774b160906458faaa9b98b813a Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Tue, 24 May 2022 00:17:40 +0300 Subject: [PATCH] pikvm/pikvm#739: reversed mouse option --- web/kvm/index.html | 9 +++++++++ web/kvm/navbar-system.pug | 2 ++ web/share/js/kvm/mouse.js | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/web/kvm/index.html b/web/kvm/index.html index 5b174f0b..579b0f94 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -267,6 +267,15 @@ + + Reverse mouse scrolling: + +
+ + +
+ + Connect HID to Server: diff --git a/web/kvm/navbar-system.pug b/web/kvm/navbar-system.pug index 1f3ee6c4..4bbb517c 100644 --- a/web/kvm/navbar-system.pug +++ b/web/kvm/navbar-system.pug @@ -71,6 +71,8 @@ li(class="right") td(id="hid-mouse-sens-value" class="value" style="min-width: 30px; max-width:30px") tr(id="hid-mouse-squash" class="feature-disabled") +menu_switch_notable("hid-mouse-squash-switch", "Squash relative mouse moves", true, true) + tr + +menu_switch_notable("hid-mouse-reverse-scrolling-switch", "Reverse mouse scrolling", true, false) tr(id="hid-connect" class="feature-disabled") +menu_switch_notable("hid-connect-switch", "Connect HID to Server", true, true) tr diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index cbcd99da..3be12cd7 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -64,6 +64,7 @@ export function Mouse(__getGeometry, __recordWsEvent) { $("stream-box").ontouchstart = (event) => __streamTouchMoveHandler(event); tools.storage.bindSimpleSwitch($("hid-mouse-squash-switch"), "hid.mouse.squash", true); + tools.storage.bindSimpleSwitch($("hid-mouse-reverse-scrolling-switch"), "hid.mouse.reverse_scrolling", false); tools.slider.setParams($("hid-mouse-sens-slider"), 0.1, 1.9, 0.1, tools.storage.get("hid.mouse.sens", 1.0), __updateRelativeSens); tools.slider.setParams($("hid-mouse-rate-slider"), 10, 100, 10, tools.storage.get("hid.mouse.rate", 100), __updateRate); // set __timer }; @@ -280,6 +281,10 @@ export function Mouse(__getGeometry, __recordWsEvent) { } if (delta.x || delta.y) { + if ($("hid-mouse-reverse-scrolling-switch").checked) { + delta.x *= -1; + delta.y *= -1; + } tools.debug("Mouse: scrolled:", delta); __sendEvent("mouse_wheel", {"delta": delta}); }