mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-03 19:51:49 +00:00
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:
1 parent
2d0fd268de
commit
7cfd97ba51
3 files changed
+18
-3
No files matched your search
@@ -122,7 +122,14 @@ export class MapController {
|
|||||||
this.canvas.height = Math.round(height * ratio)
|
this.canvas.height = Math.round(height * ratio)
|
||||||
this.view.width = width
|
this.view.width = width
|
||||||
this.view.height = height
|
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. */
|
/** Shows a view; the region view previews {@code preview} everywhere when it is not null. */
|
||||||
|
|||||||
@@ -86,7 +86,14 @@ export class TiledView<Tile, Layer, Style> {
|
|||||||
this.canvas.height = Math.round(height * ratio)
|
this.canvas.height = Math.round(height * ratio)
|
||||||
this.view.width = width
|
this.view.width = width
|
||||||
this.view.height = height
|
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 {
|
show(layer: Layer | null, style: Style): void {
|
||||||
|
|||||||
@@ -431,7 +431,8 @@ class Stage {
|
|||||||
this.camera.aspect = width / height
|
this.camera.aspect = width / height
|
||||||
this.camera.updateProjectionMatrix()
|
this.camera.updateProjectionMatrix()
|
||||||
this.notifyMoved()
|
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 {
|
private requestFrame(): void {
|
||||||
|
|||||||
Reference in new issue
Block a user