summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-11-07 05:55:34 +0300
committerDevaev Maxim <[email protected]>2020-11-07 05:55:34 +0300
commitb83ba7692ae96a4d1e479f48d5194c697295719a (patch)
treed5d31bc784bf732d554e152b7468d605b6766cbd /web
parentafcd6408bba3852fcfdb8a795e0baa9d8f4d1d7d (diff)
optional relative squashing
Diffstat (limited to 'web')
-rw-r--r--web/kvm/index.html32
-rw-r--r--web/kvm/navbar-system.pug13
-rw-r--r--web/kvm/navbar.pug11
-rw-r--r--web/share/js/kvm/mouse.js12
4 files changed, 49 insertions, 19 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html
index e494a920..ee2b7fe6 100644
--- a/web/kvm/index.html
+++ b/web/kvm/index.html
@@ -143,16 +143,30 @@
</div>
</div>
<hr>
- <div class="text">
- <table class="one-line-switch">
- <td>Auto-resize stream:</td>
- <td align="right">
- <div class="switch-box">
- <input checked type="checkbox" id="stream-auto-resize-checkbox">
- <label for="stream-auto-resize-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
+ <div class="text">
+ <table class="one-line-switch">
+ <td>Auto-resize stream:</td>
+ <td align="right">
+ <div class="switch-box">
+ <input checked type="checkbox" id="stream-auto-resize-checkbox">
+ <label for="stream-auto-resize-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
+ </div>
+ </td>
+ </table>
+ </div>
+ <div class="feature-disabled" id="mouse-squash">
+ <hr>
+ <div class="text">
+ <table class="one-line-switch">
+ <td>Squash mouse moves:</td>
+ <td align="right">
+ <div class="switch-box">
+ <input checked type="checkbox" id="mouse-squash-checkbox">
+ <label for="mouse-squash-checkbox"><span class="switch-inner"></span><span class="switch"></span></label>
+ </div>
+ </td>
+ </table>
</div>
- </td>
- </table>
</div>
<hr>
<div class="buttons">
diff --git a/web/kvm/navbar-system.pug b/web/kvm/navbar-system.pug
index d6e76156..efcc4a6d 100644
--- a/web/kvm/navbar-system.pug
+++ b/web/kvm/navbar-system.pug
@@ -35,15 +35,10 @@ li(class="right")
div(class="stream-param-box")
input(type="range" id="stream-size-slider" class="slider")
hr
- div(class="text")
- table(class="one-line-switch")
- td Auto-resize stream:
- td(align="right")
- div(class="switch-box")
- input(checked type="checkbox" id="stream-auto-resize-checkbox")
- label(for="stream-auto-resize-checkbox")
- span(class="switch-inner")
- span(class="switch")
+ +menu_switch("stream-auto-resize-checkbox", "Auto-resize stream")
+ div(id="mouse-squash" class="feature-disabled")
+ hr
+ +menu_switch("mouse-squash-checkbox", "Squash mouse moves")
hr
div(class="buttons")
button(disabled data-force-hide-menu id="stream-reset-button") &bull; Reset stream
diff --git a/web/kvm/navbar.pug b/web/kvm/navbar.pug
index 422cf236..4c83fc73 100644
--- a/web/kvm/navbar.pug
+++ b/web/kvm/navbar.pug
@@ -13,6 +13,17 @@ mixin menu_message(icon, short, classes="")
sup(style="line-height:1")
block
+mixin menu_switch(id, title)
+ div(class="text")
+ table(class="one-line-switch")
+ td #{title}:
+ td(align="right")
+ div(class="switch-box")
+ input(checked type="checkbox" id=id)
+ label(for=id)
+ span(class="switch-inner")
+ span(class="switch")
+
ul(id="navbar")
li(class="left")
a(id="logo" href="/") &larr;&nbsp;&nbsp;
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});
+ }
}
};