@umicat/phaser-sdk 1.0.21 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1822,10 +1822,22 @@ export class EditorOverlayScene extends Phaser.Scene {
|
|
|
1822
1822
|
// World mode → the camera viewport rect: where the runtime camera
|
|
1823
1823
|
// looks + how much it sees (intrinsic/zoom). Small inside a larger
|
|
1824
1824
|
// world for farming/RPG; coincides with world bounds for Tetris etc.
|
|
1825
|
-
const
|
|
1826
|
-
const
|
|
1825
|
+
const z = worldSceneCam.zoom;
|
|
1826
|
+
const camW = intrinsicW / z;
|
|
1827
|
+
const camH = intrinsicH / z;
|
|
1828
|
+
// Phaser zooms around the camera's viewport CENTRE (default origin
|
|
1829
|
+
// 0.5), so the world coord at the camera's top-left is
|
|
1830
|
+
// `scrollX + (intrinsicW/2)(1 - 1/z)`, NOT scrollX. At z=1 the term is
|
|
1831
|
+
// 0 (unchanged — Tetris/Space-Invaders etc. are unaffected); at any
|
|
1832
|
+
// other zoom this keeps the rect aligned with what cameras.main really
|
|
1833
|
+
// frames — and with the editor rulers/axes, which apply the same
|
|
1834
|
+
// correction. Computed manually rather than reading
|
|
1835
|
+
// `worldSceneCam.worldView` because the runtime cam is hidden in edit
|
|
1836
|
+
// mode and may not preRender, so its worldView can be stale.
|
|
1837
|
+
const viewX = camX + (intrinsicW / 2) * (1 - 1 / z);
|
|
1838
|
+
const viewY = camY + (intrinsicH / 2) * (1 - 1 / z);
|
|
1827
1839
|
this.graphics.lineStyle(CAMERA_VIEWPORT_LINE_WIDTH, CAMERA_VIEWPORT_COLOR, CAMERA_VIEWPORT_ALPHA);
|
|
1828
|
-
this.graphics.strokeRect(
|
|
1840
|
+
this.graphics.strokeRect(viewX, viewY, camW, camH);
|
|
1829
1841
|
}
|
|
1830
1842
|
}
|
|
1831
1843
|
const selectedId = getSelection(this.game);
|