From bc6f5873f17ae10f42f87825ac64b136cfee3d72 Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 29 May 2022 17:11:48 -0500 Subject: add zooming and panning --- src/modules/Util.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/modules') 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 }; -- cgit v1.2.1