summaryrefslogtreecommitdiff
path: root/web/share
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2021-09-27 14:51:54 +0300
committerMaxim Devaev <[email protected]>2021-09-27 14:51:54 +0300
commit9f9396a8104e56bc95a66fcef4a45b3938b86e7c (patch)
tree7e6f963dee80bc3dc5bdc9167152b10309d24fc9 /web/share
parent67b67f6cbc820dbc233599d9ccafeded785879ac (diff)
configurable mouse polling rate
Diffstat (limited to 'web/share')
-rw-r--r--web/share/js/kvm/mouse.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js
index 7a0a50f3..7fc58905 100644
--- a/web/share/js/kvm/mouse.js
+++ b/web/share/js/kvm/mouse.js
@@ -38,6 +38,7 @@ export function Mouse(__getResolution, __recordWsEvent) {
var __keypad = null;
+ var __timer = null;
var __current_pos = {x: 0, y: 0};
var __sent_pos = {x: 0, y: 0};
var __wheel_delta = {x: 0, y: 0};
@@ -62,6 +63,11 @@ export function Mouse(__getResolution, __recordWsEvent) {
$("stream-box").onwheel = __streamWheelHandler;
$("stream-box").ontouchstart = (event) => __streamTouchMoveHandler(event);
+ let rate_slider = $("hid-mouse-rate-slider");
+ tools.slider.setParams(rate_slider, 10, 100, 10, 100);
+ rate_slider.oninput = rate_slider.onchange = __updateRate;
+ rate_slider.value = tools.storage.get("hid.mouse.rate", 100);
+
let sens_slider = $("hid-mouse-sens-slider");
tools.slider.setParams(sens_slider, 0.1, 1.9, 0.1, 1);
sens_slider.oninput = sens_slider.onchange = __updateRelativeSens;
@@ -70,7 +76,7 @@ export function Mouse(__getResolution, __recordWsEvent) {
tools.storage.bindSimpleSwitch($("hid-mouse-squash-switch"), "hid.mouse.squash", true);
- setInterval(__sendMove, 100);
+ __updateRate(); // set __timer
};
/************************************************************************/
@@ -104,6 +110,16 @@ export function Mouse(__getResolution, __recordWsEvent) {
__keypad.releaseAll();
};
+ var __updateRate = function() {
+ let rate = parseInt($("hid-mouse-rate-slider").value);
+ $("hid-mouse-rate-value").innerHTML = rate;
+ tools.storage.set("hid.mouse.rate", rate);
+ if (__timer) {
+ clearInterval(__timer);
+ }
+ __timer = setInterval(__sendMove, rate);
+ };
+
var __updateRelativeSens = function() {
__relative_sens = parseFloat($("hid-mouse-sens-slider").value);
$("hid-mouse-sens-value").innerHTML = __relative_sens.toFixed(1);