Skip to content

Commit

Permalink
Fix error on puzzle reset
Browse files Browse the repository at this point in the history
  • Loading branch information
luxaritas committed Jan 20, 2022
1 parent 51b9627 commit 5fc539b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/eterna/pose3D/Pose3D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ export default class Pose3D extends ContainerObject {
}

public dispose() {
this._stage.removeAllComponents();
this._stage.dispose();
this._nglDiv.remove();
super.dispose();
}

private initControls() {
Expand Down
3 changes: 3 additions & 0 deletions src/eterna/pose3D/Pose3DWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ export default class Pose3DWindow extends ContainerObject implements MouseWheelL

this._nglSprite = new SpriteObject(Sprite.from(this._nglStage.viewer.renderer.domElement));
this._nglStage.viewer.signals.rendered.add(() => {
// We've removed the 3D view, but NGL hasn't been fully destroyed yet
if (!this._nglSprite.display.texture) return;

this._nglSprite.display.texture.update();
this._nglSprite.display.width = this._currentBounds.width;
this._nglSprite.display.height = this._currentBounds.height - this.ICON_SIZE;
Expand Down

0 comments on commit 5fc539b

Please sign in to comment.