diff --git a/src/javascript/simulations/doubleSlit.js b/src/javascript/simulations/doubleSlit.js index a6a9c1b..3c6f626 100644 --- a/src/javascript/simulations/doubleSlit.js +++ b/src/javascript/simulations/doubleSlit.js @@ -165,7 +165,9 @@ class DoubleSlitSimulation extends Simulation { mouseUp = (event) => {}; mouseMove = (event, x, y) => { + const prevX = this.screen.x; this.screen.x = Math.max(Math.min(x, this.screen.maxX), this.screen.minX); + if (prevX === this.screen.x) return; this.redraw = true; this.cache = {}; } diff --git a/src/javascript/simulations/nSlit.js b/src/javascript/simulations/nSlit.js index 67ea08e..451d6c0 100644 --- a/src/javascript/simulations/nSlit.js +++ b/src/javascript/simulations/nSlit.js @@ -175,7 +175,9 @@ class NSlitSimulation extends Simulation { mouseUp = () => {}; mouseMove = (event, x, y) => { + const prevY = this.screen.y; this.screen.y = Math.max(Math.min(y, this.screen.maxY), this.screen.minY); + if (prevY === this.screen.y) return; this.redraw = true; this.cache = {}; } diff --git a/src/javascript/simulations/singleSlit.js b/src/javascript/simulations/singleSlit.js index 66d55a8..2ebe63f 100644 --- a/src/javascript/simulations/singleSlit.js +++ b/src/javascript/simulations/singleSlit.js @@ -105,7 +105,9 @@ class SingleSlitSimulation extends Simulation { mouseUp = (event) => {}; mouseMove = (event, x, y) => { + const prevX = this.screen.x; this.screen.x = Math.max(Math.min(x, this.screen.maxX), this.screen.minX); + if (prevX === this.screen.x) return; this.redraw = true; this.cache = {}; }