Skip to content

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.

fix(editor): the design screen is framed by what the eye sees, not by its own rect

yhh0c4fe8b0cd7a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e2d63d528..04d72b0ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,44 @@ published separately; it ships inside the editor.
### Added
+- **`view.frameCanvas` — "Frame Design Screen" is a command now.** The viewport
+ has had the button since design mode shipped and nothing behind it, so the
+ command palette, a keybinding and a driver could all reach every other view
+ action and not that one.
+
+### Fixed
+
+- **Framing the design screen under-framed it from any turned eye.** `frameCanvas`
+ fitted the authored rect by its own half-extents, while `frameSelection` right
+ beside it fits "the box as the EYE sees it" — so pressing the frame button in a
+ turned or perspective view left most of the screen off the viewport. It fits by
+ what the rect COVERS now, which is the rule the neighbouring code already
+ states: from a turned eye the extent is what the view covers, not the footprint
+ that coverage has on the plane. Head-on is unchanged, which is why this went
+ unnoticed.
+
+- **`design-frame` had never passed, and it was not measuring the frame.** The
+ check asserts that the authored screen is drawn as a trapezoid from a turned
+ eye. Turning the eye pushed the screen off the viewport, so on most rows only
+ ONE of its two side strokes was visible and the span it measured ran from that
+ stroke to whatever sat at the viewport's edge — a number pinned by the window,
+ not by the frame. That is why it failed at one window size and "passed" at
+ another: the passing size was a false positive. It frames the screen after
+ turning now, and passes on the shape it is actually about — 42/42 editor checks.
+
+- **`RELEASE` in the release gate is derived from the shipped version.** It was a
+ literal, and 0.58 shipped under a list headed "0.57 exit criteria" because
+ cutting the notes bumped every other version and not this one. The file exists
+ to stop a list and its checks drifting apart; it cannot be a second place the
+ version is written.
+
+- **`World.layoutEpoch()` answers on a native host.** It returned null there —
+ "assume everything moved" — because the epoch was reachable only as a function
+ on the wasm module, and a native host has no module. It is a registry binding
+ now (`es_registryLayoutEpoch`), so one door answers the same question on both
+ cores and the AOT runtime stops re-reporting every script pool every frame.
+
+
- **The native row table is kept across frames, so both AOT roads now answer the
same two questions.** `AotDispatch.ts` states the model the web road has always
worked to: a row table is a function of two things — which entities match, and
diff --git a/desktop b/desktop
index aaca534ae..49c9e5ed5 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit aaca534ae2acc9622fcdff7c9fbbe83090a14f3e
+Subproject commit 49c9e5ed5af00339e652414b69f428e2a42da41e
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index 528de6a3d..426195332 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -139,14 +139,20 @@ experimental 对创作者读起来是「大半个引擎没做完」,哪怕其
那个头文件自己写着「后面的成员往后追加不需要 std140 padding」。改完之后 SSAO / fog / DOF
就都是普通 shader 活,不是引擎活。
-## 5. 两处小的,但正在削弱「清单是真的」
-
-- **`design-frame` 在这台机器上从来没绿过。** HEAD、加它那个提交的父提交、它自己那个提交
- (`1c8dadaac`)全红。它量的是编辑器窗口大小的函数:`ESTELLA_WIN_W/H` 默认 1480x920 红,
- 1920x1200 绿。把窗口钉成绿的那个尺寸 = 拿环境去迁就断言。要么把 8% 那个门槛从实际视口
- 推出来,要么钉住窗口**并重新标定其它检查**。一个从没绿过的检查不是检查。
-- **`tools/releaseGate.mjs` 的 `RELEASE` 还是 `'0.57'`**,而 0.58.0 已经出了。那个文件
- 存在的全部理由就是防止清单漂移。
+## 5. 两处小的,但正在削弱「清单是真的」〔已落地 2026-08-27〕
+
+- **`design-frame` 从来没绿过 —— 而且它根本没在量那个框。** 原因不是窗口大小:转过视角
+ 之后设计画布跑出了视口,所以大多数行上只看得见它**一条**边框,量到的跨度是「那条边框
+ 到视口边缘」——一个由窗口钉死的数,不是由框钉死的。所以它在一个尺寸下红、另一个尺寸下
+ 「绿」:**绿的那次是假阳性**。修法是转完视角之后重新取景。
+ 顺带挖出一个真的编辑器 bug:`frameCanvas` 按设计矩形自身的半宽高取景,而它旁边的
+ `frameSelection` 按「**眼睛看到的**那个盒子」取景 —— 于是在任何转过的视角下按取景按钮
+ 都会把画布框丢在视口外。正对时两者一样,所以一直没人发现。
+ 还顺带补了一个命令:`view.frameCanvas`(视口一直有这个按钮,却没有命令,命令面板、
+ 快捷键和 driver 都够不着它)。42/42 editor checks 绿。
+- **`RELEASE` 改成从 package.json 推导**。它曾是字面量,于是 0.58 是在一份标题写着
+ 「0.57 exit criteria」的清单下发的。一个存在理由就是「不让清单和检查漂移」的文件,
+ 不能自己成为版本号的第二处来源。
## 明确不做的(省得重新评估)
diff --git a/native/host/bindings/EcsBindings.cpp b/native/host/bindings/EcsBindings.cpp
index 8d035523a..7d6888dd6 100644
--- a/native/host/bindings/EcsBindings.cpp
+++ b/native/host/bindings/EcsBindings.cpp
@@ -34,6 +34,15 @@ namespace {
JSValue js_createEntity(JSContext* ctx, JSValueConst, int, JSValueConst*) {
return JS_NewUint32(ctx, host().registry->create().id());
}
+/**
+ * Every pool's version in one number — `Registry::layoutEpoch`, which the web
+ * build reaches as an embind free function. A holder of raw addresses asks this
+ * before trusting them for another frame, and a host that cannot answer makes
+ * that holder re-resolve everything every frame.
+ */
+JSValue js_layoutEpoch(JSContext* ctx, JSValueConst, int, JSValueConst*) {
+ return JS_NewFloat64(ctx, host().registry->layoutEpoch());
+}
JSValue js_destroyEntity(JSContext* ctx, JSValueConst, int, JSValueConst* argv) {
host().registry->destroy(esn_entity(ctx, argv[0]));
return JS_UNDEFINED;
@@ -111,6 +120,7 @@ void registerEcsBindings(HostState& h, JSValue global) {
bindGlobal(h, global, "es_getChildren", js_getChildren, 1);
bindGlobal(h, global, "es_getMeshSkinJoints", js_getMeshSkinJoints, 1);
bindGlobal(h, global, "es_setMeshSkinJoints", js_setMeshSkinJoints, 2);
+ bindGlobal(h, global, "es_registryLayoutEpoch", js_layoutEpoch, 0);
}
} // namespace eshost
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index f4223b1b5..67c806d9e 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -6401,7 +6401,7 @@ static prototype: QueryInstance<any>
## REGISTRY_BINDINGS — const @experimental
```
-{ readonly createEntity: "es_createEntity"; readonly destroyEntity: "es_destroyEntity"; readonly setParent: "es_setParent"; readonly hasParent: "es_hasParent"; readonly getParent: "es_getParent"; readonly removeParent: "es_removeParent"; readonly hasChildren: "es_hasChildren"; readonly getChildren: "es_getChildren"; readonly getMeshSkinJoints: "es_getMeshSkinJoints"; readonly setMeshSkinJoints: "es_setMeshSkinJoints"; }
+{ readonly createEntity: "es_createEntity"; readonly destroyEntity: "es_destroyEntity"; readonly setParent: "es_setParent"; readonly hasParent: "es_hasParent"; readonly getParent: "es_getParent"; readonly removeParent: "es_removeParent"; readonly hasChildren: "es_hasChildren"; readonly getChildren: "es_getChildren"; readonly getMeshSkinJoints: "es_getMeshSkinJoints"; readonly setMeshSkinJoints: "es_setMeshSkinJoints"; readonly layoutEpoch: "es_registryLayoutEpoch"; }
```
## RENAMED_COMPONENT_TYPES — const @experimental
diff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.md
index 9c3b73e9e..0c7d81b5b 100644
--- a/sdk/etc/wasm.api.md
+++ b/sdk/etc/wasm.api.md
@@ -134,6 +134,7 @@ hasUINode: (entity: Entity) => boolean
hasUIScroll: (entity: Entity) => boolean
hasUIVisual: (entity: Entity) => boolean
hasVelocity: (entity: Entity) => boolean
+layoutEpoch: (() => number) | undefined
removeBitmapText: (entity: Entity) => void
removeBoxCollider2D: (entity: Entity) => void
removeBoxCollider3D: (entity: Entity) => void
diff --git a/sdk/src/ecs/bridge/BuiltinBridge.ts b/sdk/src/ecs/bridge/BuiltinBridge.ts
index 160acfc4c..3a4af7103 100644
--- a/sdk/src/ecs/bridge/BuiltinBridge.ts
+++ b/sdk/src/ecs/bridge/BuiltinBridge.ts
@@ -555,6 +555,10 @@ export class BuiltinBridge {
layoutEpoch(): number | null {
const registry = this.cppRegistry_;
if (!registry) return null;
+ // The registry's own where the core binds it there (native), else the
+ // module's free function (web). One question, two spellings, because the
+ // two cores expose a Registry differently.
+ if (typeof registry.layoutEpoch === 'function') return registry.layoutEpoch();
const fn = (this.module_ as unknown as Record<string, unknown> | null)?.['registryLayoutEpoch'];
if (typeof fn !== 'function') return null;
return (fn as (r: CppRegistry) => number)(registry);
diff --git a/sdk/src/ecs/bridge/nativeBindings.ts b/sdk/src/ecs/bridge/nativeBindings.ts
index df6139c3a..9323eed89 100644
--- a/sdk/src/ecs/bridge/nativeBindings.ts
+++ b/sdk/src/ecs/bridge/nativeBindings.ts
@@ -37,6 +37,9 @@ export const REGISTRY_BINDINGS = {
// POD layout and no generated accessor — the same reason Children is here.
getMeshSkinJoints: 'es_getMeshSkinJoints',
setMeshSkinJoints: 'es_setMeshSkinJoints',
+ // The web build reaches this as an embind free function on the module; a
+ // native host has no module, so it is a binding like the rest.
+ layoutEpoch: 'es_registryLayoutEpoch',
} as const;
/**
diff --git a/sdk/src/ecs/bridge/nativeRegistry.ts b/sdk/src/ecs/bridge/nativeRegistry.ts
index c22bc4c17..6183b3844 100644
--- a/sdk/src/ecs/bridge/nativeRegistry.ts
+++ b/sdk/src/ecs/bridge/nativeRegistry.ts
@@ -88,6 +88,10 @@ export function createNativeRegistry(
// hand (the native siblings of the embind Registry's entity ops).
reg.create = (): Entity => hostCall(scope, REGISTRY_BINDINGS.createEntity, []) as Entity;
reg.destroy = (e: Entity): void => { hostCall(scope, REGISTRY_BINDINGS.destroyEntity, [e]); };
+ // Required like the rest of the set, and `assertNativeBindings` says so at
+ // boot: a host that cannot date its world makes every holder of an address
+ // re-resolve it every frame, silently.
+ reg.layoutEpoch = (): number => hostCall(scope, REGISTRY_BINDINGS.layoutEpoch, []) as number;
reg.hasParent = (e: Entity): boolean => !!hostCall(scope, REGISTRY_BINDINGS.hasParent, [e]);
reg.setParent = (child: Entity, parent: Entity): void => {
hostCall(scope, REGISTRY_BINDINGS.setParent, [child, parent]);
diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.ts
index c9c6a6cc8..a72dc083a 100644
--- a/sdk/src/wasm.ts
+++ b/sdk/src/wasm.ts
@@ -31,6 +31,10 @@ export interface CppEngineContext {
export interface CppRegistry extends GeneratedRegistry {
delete(): void;
removeParent(entity: Entity): void;
+ /** Every pool's version in one number, where the core binds it on the
+ * registry itself. The web module answers the same question as a free
+ * function; absent on a core built before either existed. */
+ layoutEpoch?(): number;
[key: string]: Function | undefined;
}
diff --git a/tools/releaseGate.mjs b/tools/releaseGate.mjs
index 29257b497..04fc5eca6 100644
--- a/tools/releaseGate.mjs
+++ b/tools/releaseGate.mjs
@@ -14,8 +14,20 @@
*
* This says the criteria are OWNED. Whether they PASS is what running them says.
*/
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
-export const RELEASE = '0.57';
+/**
+ * Which release these are the exit criteria for — derived, not typed.
+ *
+ * It was a literal and it drifted: 0.58 shipped under a list headed "0.57 exit
+ * criteria". A file whose purpose is refusing to let a list and its checks drift
+ * apart cannot be a second place the version is written.
+ */
+export const RELEASE = JSON.parse(readFileSync(
+ path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8',
+)).version.split('.').slice(0, 2).join('.');
/**
* `answeredBy` is a shell command run from the repo root; `needs` are the files