summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-05-29 17:11:48 -0500
committersanine <sanine.not@pm.me>2022-05-29 17:11:48 -0500
commitbc6f5873f17ae10f42f87825ac64b136cfee3d72 (patch)
treef433186af60125c45ba63f545a556afc48c24e23 /src/modules
parent62ccd5f48cd1f49effaa76ef01eb45072a0a42df (diff)
add zooming and panning
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/Util.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/Util.js b/src/modules/Util.js
index cbe466d..2375f10 100644
--- a/src/modules/Util.js
+++ b/src/modules/Util.js
@@ -10,4 +10,8 @@ function useAverage() {
return [() => avg, append];
}
-export { useAverage };
+function clamp(value, min, max) {
+ return Math.min(Math.max(value, min), max);
+}
+
+export { useAverage, clamp };