Skip to content

Commit b3073ee

Browse files
committed
Recalculate viewport when it changes, automatically
1 parent 423e0e1 commit b3073ee

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/engine.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,19 @@ export class Engine<T> {
476476
return;
477477
}
478478

479+
if (
480+
// @ts-ignore
481+
gl.canvas.width != gl.canvas.clientWidth ||
482+
// @ts-ignore
483+
gl.canvas.height != gl.canvas.clientHeight
484+
) {
485+
// @ts-ignore
486+
gl.canvas.width = gl.canvas.clientWidth;
487+
// @ts-ignore
488+
gl.canvas.height = gl.canvas.clientHeight;
489+
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
490+
}
491+
479492
const REPEAT_MAP: Record<repeat_mode, number> = {
480493
repeat: gl.REPEAT,
481494
clamp_to_edge: gl.CLAMP_TO_EDGE,

0 commit comments

Comments
 (0)