| 83 | } |
| 84 | |
| 85 | static override async reset(): Promise<void> { |
| 86 | const promises: Promise<any>[] = []; |
| 87 | |
| 88 | // Go through each canvas element being shown so it can be properly |
| 89 | // stopped and then removed. |
| 90 | this.engine.element().find('[data-component="canvas-container"]').each((canvasContainer: any) => { |
| 91 | const { object } = canvasContainer.props; |
| 92 | |
| 93 | promises.push(Util.callAsync(object.stop, this.engine, canvasContainer.layers, object.props, object.state, canvasContainer).then(() => { |
| 94 | canvasContainer.remove(); |
| 95 | })); |
| 96 | }); |
| 97 | |
| 98 | this.engine.history({ |
| 99 | canvas: [] |
| 100 | }); |
| 101 | |
| 102 | this.engine.state({ |
| 103 | canvas: [] |
| 104 | }); |
| 105 | |
| 106 | await Promise.all(promises); |
| 107 | } |
| 108 | |
| 109 | static override matchString([show, type]: string[]): boolean { |
| 110 | return show === 'show' && type === 'canvas'; |