Skip to content

Commit

Permalink
fix: Stopping the renderer resolves in-process dice rolls (close #285)
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Jan 3, 2024
1 parent 06a55a5 commit 74d33c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,14 @@ export default class DiceRenderer extends Component {
}
stop() {
if (this.#animating) {
for (const dice of [...this.#current].flat()) {
dice.stopped = true;
for (const shape of [...this.#current]) {
if (this.#finished.has(shape)) {
this.#finished.get(shape)();
this.#finished.delete(shape);
}
for (const dice of shape) {
dice.stopped = true;
}
}
}
this.#animating = false;
Expand Down
2 changes: 0 additions & 2 deletions src/roller/dice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1113,8 +1113,6 @@ export class StackRoller extends GenericRoller<number> {
}
if (evt.getModifierState("Shift")) {
await this.roll(true);
/* this.render();
this.trigger("new-result"); */
this.hasRunOnce = true;
} else if (window.getSelection()?.isCollapsed) {
await this.roll();
Expand Down

0 comments on commit 74d33c6

Please sign in to comment.