From 9a6025dad340b304f1193e9272260039f21ddc1c Mon Sep 17 00:00:00 2001 From: Smitty Date: Tue, 28 Sep 2021 07:34:17 -0400 Subject: [PATCH] Add a maximum zoom amount --- public/script.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/script.js b/public/script.js index 7502c28..37a4f21 100644 --- a/public/script.js +++ b/public/script.js @@ -39,6 +39,7 @@ if (window.matchMedia) { } const MIN_SCALE = 10; // can't scale lower than this +const MAX_SCALE = 500; // can't scale higher than this const ARROW_LEN = 0.1; // how far back arrows go const LINE_WIDTH = 0.04; const ARROW_ANGLE_DIV = 6; // arrow angle @@ -352,6 +353,8 @@ window.addEventListener("wheel", e => { const delta = e.deltaY / -speed; if ((state.scale + delta) < MIN_SCALE) { state.scale = MIN_SCALE; + } else if ((state.scale + delta) > MAX_SCALE) { + state.scale = MAX_SCALE; } else { state.scale += delta; } -- 2.45.2