Skip to content

Commit

Permalink
removing interval on disable
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Dec 3, 2021
1 parent 5cbf589 commit 81acf95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/editor-view/game-container/game-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class GameContainer extends HTMLElement {

// returns the game to its original parent
public disable() {
this.selectionArea.disable();
const el = this.game.canvas.parentElement;
el.classList.remove('phred-game');
this.gameOriginalParentElement.appendChild(el);
Expand Down
4 changes: 4 additions & 0 deletions src/editor-view/selectors/selection-area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export class SelectionArea extends HTMLElement {
this.interval = setInterval(this.update.bind(this), INTERVAL);
}

public disable() {
clearInterval(this.interval);
}

private createHandlers(selection: Selection) {
this.selectionHandler = new SelectionHandler(selection);
this.moveHandler = new MoveHandler(selection);
Expand Down

0 comments on commit 81acf95

Please sign in to comment.