Skip to content

Commit

Permalink
reset animation toggling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamed-souiyeh authored May 28, 2024
1 parent 20b8792 commit 41f2e1a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/cell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,9 @@ export class Cell {
};
if (globals.resetAnimation === false) {
this.#redraw = true;
this.#setStoppedAnimationRequirements();
}
if (globals.hotReload === false && globals.resetAnimation && (this.animation === CellAnimation.STOPPED || this.animation === CellAnimation.STOPPING)) {
else if (globals.hotReload === false && globals.resetAnimation && (this.animation === CellAnimation.STOPPED || this.animation === CellAnimation.STOPPING)) {
this.#setInwardsAnimationRequirements();
}
}
Expand Down Expand Up @@ -413,9 +414,6 @@ export class Cell {
this.#velocity = this.#velocity < 0 ? this.#velocity : -this.#velocity;
}

setStoppedAnimationRequirements() {
this.#setStoppedAnimationRequirements();
}

#setStoppedAnimationRequirements() {
if (this.animation === CellAnimation.STOPPED) return;
Expand Down Expand Up @@ -532,7 +530,6 @@ export class Cell {
let step = this.#velocity;

if (this.animation === CellAnimation.STOPPING) {

this.#setStoppedAnimationRequirements();
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ export class Grid {
if (globals.reset && globals.resetAnimation === false && globals.hotReload === false) {
for (let cell of this.eachCell()) {
cell.setState(CellStates.unvisited);
cell.setStoppedAnimationRequirements();
}
globals.reset = false;
globals.updateDepthFilter = true;
Expand Down

0 comments on commit 41f2e1a

Please sign in to comment.