A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(editor): switching between 2D and 3D keeps what you are looking at
yhh28a58c5c0401
diff --git a/desktop/src/engine/EngineHost.ts b/desktop/src/engine/EngineHost.tsindex bf7070370..b5862f734 100644--- a/desktop/src/engine/EngineHost.ts+++ b/desktop/src/engine/EngineHost.ts@@ -360,7 +360,15 @@ class EngineHostImpl {*/setViewPerspective(on: boolean): void {const view = this.getResource(EditorView);- if (view) view.perspective = on;+ if (!view || view.perspective === on) return;+ // Switching projection keeps the FRAMING: the two modes zoom with different+ // fields (a box half-height, a camera distance), so flipping the flag alone+ // jumped to whatever the other field happened to hold — the scene lurched+ // ~2× on a button that is supposed to change how depth looks, not what you+ // are looking at. Carry the seen extent across; one formula owns both.+ const seen = editorViewHalfHeight(view);+ view.perspective = on;+ setEditorViewHalfHeight(view, seen);}/** The active (or first) scene camera's center + ortho half-height, for seeding. */