aboutsummaryrefslogtreecommitdiffziptar.gz
path: root/viewer/js/input.js
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/js/input.js')
-rw-r--r--viewer/js/input.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/viewer/js/input.js b/viewer/js/input.js
new file mode 100644
index 0000000..c977e32
--- /dev/null
+++ b/viewer/js/input.js
@@ -0,0 +1,4 @@
+// input.js — tell a click from a drag
+export function isClick(down, up, maxPx = 5, maxMs = 600) {
+ return Math.hypot(up.x - down.x, up.y - down.y) <= maxPx && up.t - down.t <= maxMs;
+}