[ts][core] Fix SceneRenderer missing checks.

This commit is contained in:
Davide Tantillo 2025-04-15 12:33:54 +02:00
parent 606a5e5a30
commit f5d1f99974

View File

@ -473,7 +473,7 @@ export class SceneRenderer implements Disposable {
canvas.height = h;
}
if (resizeMode === ResizeMode.FitClip) {
if (resizeMode === ResizeMode.FitClip && worldWidth !== undefined && worldHeight !== undefined) {
let targetRatio = h / w, sourceRatio = worldHeight / worldWidth;
let scale = targetRatio > sourceRatio ? w / worldWidth : h / worldHeight;
worldWidth *= scale;