diff options
author | sanine <sanine.not@pm.me> | 2022-05-29 17:11:48 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-05-29 17:11:48 -0500 |
commit | bc6f5873f17ae10f42f87825ac64b136cfee3d72 (patch) | |
tree | f433186af60125c45ba63f545a556afc48c24e23 /src/modules/Util.js | |
parent | 62ccd5f48cd1f49effaa76ef01eb45072a0a42df (diff) |
add zooming and panning
Diffstat (limited to 'src/modules/Util.js')
-rw-r--r-- | src/modules/Util.js | 6 |
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 }; |