~smitop/eigen.fun

9a6025dad340b304f1193e9272260039f21ddc1c — Smitty 2 years ago 121aa4d
Add a maximum zoom amount
1 files changed, 3 insertions(+), 0 deletions(-)

M public/script.js
M public/script.js => public/script.js +3 -0
@@ 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;
    }