Keep maps drawn while a pane is resized

- Draw the map and tiled views right after sizing their canvas
- Render the 3D view right after sizing it
This commit is contained in:
piexel committed 2026-11-25 22:29:45 +01:00
1 parent 2d0fd268de
commit 7cfd97ba51
3 files changed
+18 -3

No files matched your search

+8 -1
View File
@@ -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. */
+8 -1
View File
@@ -86,7 +86,14 @@ export class TiledView<Tile, Layer, Style> {
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 {
@@ -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 {