diff --git a/studio/src/renderer/src/map/MapController.ts b/studio/src/renderer/src/map/MapController.ts index 9daea732f..a9d146234 100644 --- a/studio/src/renderer/src/map/MapController.ts +++ b/studio/src/renderer/src/map/MapController.ts @@ -122,7 +122,14 @@ export class MapController { this.canvas.height = Math.round(height * ratio) this.view.width = width this.view.height = height - this.redraw() + this.drawNowAfterResize() + } + + // Sizing a canvas wipes its pixels, so waiting for the next frame would show it blank while a pane is resized. + private drawNowAfterResize(): void { + if (!this.closed) { + this.draw() + } } /** Shows a view; the region view previews {@code preview} everywhere when it is not null. */ diff --git a/studio/src/renderer/src/map/TiledView.ts b/studio/src/renderer/src/map/TiledView.ts index 9baa85eab..a477a3513 100644 --- a/studio/src/renderer/src/map/TiledView.ts +++ b/studio/src/renderer/src/map/TiledView.ts @@ -86,7 +86,14 @@ export class TiledView { this.canvas.height = Math.round(height * ratio) this.view.width = width this.view.height = height - this.redraw() + this.drawNowAfterResize() + } + + // Sizing a canvas wipes its pixels, so waiting for the next frame would show it blank while a pane is resized. + private drawNowAfterResize(): void { + if (!this.closed) { + this.draw() + } } show(layer: Layer | null, style: Style): void { diff --git a/studio/src/renderer/src/studio/SceneViewport.tsx b/studio/src/renderer/src/studio/SceneViewport.tsx index 80df2a416..df94c201d 100644 --- a/studio/src/renderer/src/studio/SceneViewport.tsx +++ b/studio/src/renderer/src/studio/SceneViewport.tsx @@ -431,7 +431,8 @@ class Stage { this.camera.aspect = width / height this.camera.updateProjectionMatrix() this.notifyMoved() - this.requestFrame() + // Sizing the canvas wipes it, so waiting for the next frame would show it blank while a pane is resized. + this.renderer.render(this.scene, this.camera) } private requestFrame(): void {