fix viewport shrinking permanently (#113)
what was happening is we were setting style.width and style.height which overrode the styles from CSS that gave us the BoundingClientRect from which we were calculating the canvas size I also added a sendViewportUpdate to prevent chunk jank
This commit is contained in:
parent
65645f410f
commit
598c0348f6
1 changed files with 3 additions and 2 deletions
|
@ -40,13 +40,14 @@ class CanvasRenderer extends HTMLElement {
|
|||
|
||||
// To properly handle DPI scaling, we want the canvas's layout size to be equal to that of
|
||||
// its parent container,
|
||||
this.style.width = `${width}px`;
|
||||
this.style.height = `${height}px`;
|
||||
this.canvas.width = width * window.devicePixelRatio;
|
||||
this.canvas.height = height * window.devicePixelRatio;
|
||||
|
||||
// Rerender immediately after the canvas is resized, as its contents have now been invalidated.
|
||||
this.#render();
|
||||
|
||||
// Send a viewport update so that the server knows to send new chunks.
|
||||
this.sendViewportUpdate();
|
||||
}
|
||||
|
||||
getWindowSize() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue