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
feat(editor): the HUD is clickable in the running game
yhh86cb64f0100b
diff --git a/desktop/src/engine/ViewportController.ts b/desktop/src/engine/ViewportController.tsindex 3aa104deb..f02490ea9 100644--- a/desktop/src/engine/ViewportController.ts+++ b/desktop/src/engine/ViewportController.ts@@ -13,7 +13,7 @@ import {readColliderShapes, colliderShapeOutline, shapeCenter,layerOrderOf,editorViewHalfHeight, editorViewHalfExtent, setEditorViewHalfHeight, EDITOR_UI_ANCHOR,- entityWorldBox,+ entityWorldBox, uiNodeWorldBox,type TilesetModel, type TileCollisionPiece, type TileGridParams,} from 'esengine';import type { EntityId } from '@/types';@@ -418,21 +418,7 @@ export const ViewportController = {* pivot-centered on the world transform). */uiEntityWorldOBB(id: EntityId): OBB | null {const world = EngineHost.world;- const module = EngineHost.module;- if (!world || !module || !world.has(id, UINode) || !world.has(id, Transform)) return null;- const reg = world.getCppRegistry();- if (!reg) return null;- const t = world.get(id, Transform);- const w = module.uiNode_computedWidth(reg, id) * t.worldScale.x;- const h = module.uiNode_computedHeight(reg, id) * t.worldScale.y;- if (!(w > 0) || !(h > 0)) return null;- return {- cx: t.worldPosition.x,- cy: t.worldPosition.y,- hw: Math.abs(w) / 2,- hh: Math.abs(h) / 2,- rot: quatAngleZ(t.worldRotation as { w: number; x: number; y: number; z: number }),- };+ return world ? uiNodeWorldBox(world, id) : null;},/**diff --git a/desktop/src/engine/playProtocol.ts b/desktop/src/engine/playProtocol.tsindex 6c3c6a967..b1ba138b3 100644--- a/desktop/src/engine/playProtocol.ts+++ b/desktop/src/engine/playProtocol.ts@@ -131,8 +131,9 @@ export interface CanvasPoint {export interface PlayOverlayBox {/** The four corners, counter-clockwise from the box's local -x,-y. */corners: CanvasPoint[];- /** The transform origin — where a move gizmo is anchored. */- origin: CanvasPoint;+ /** The transform origin — where a move gizmo is anchored. Absent for a box a+ * drag cannot move: a UI node is placed by layout, not by a position field. */+ origin?: CanvasPoint;}/** The visibility half of a live tree entity — what the Outliner's eye reads.diff --git a/desktop/src/panels/PlayOverlay.tsx b/desktop/src/panels/PlayOverlay.tsxindex f15627400..c9cd776a4 100644--- a/desktop/src/panels/PlayOverlay.tsx+++ b/desktop/src/panels/PlayOverlay.tsx@@ -43,8 +43,8 @@ const toPx = (p: CanvasPoint, w: number, h: number): [number, number] => [p.x */** Whether a press at `p` landed ON the selection: inside its outline, or within* reach of the origin handle for something that has no outline to speak of. */-function grabbed(box: PlayOverlayBox, p: CanvasPoint, size: { w: number; h: number }): boolean {- const [ox, oy] = toPx(box.origin, size.w, size.h);+function grabbed(box: PlayOverlayBox, origin: CanvasPoint, p: CanvasPoint, size: { w: number; h: number }): boolean {+ const [ox, oy] = toPx(origin, size.w, size.h);const [px, py] = toPx(p, size.w, size.h);if (Math.hypot(px - ox, py - oy) <= HANDLE * 2) return true;if (box.corners.length !== 4) return false;@@ -96,7 +96,7 @@ export function PlayOverlay({ interactive }: Props) {};/** Pointer angle + distance about the selection's origin, in CSS px. */const polarOf = (p: CanvasPoint): { angle: number; dist: number } => {- if (!overlay) return { angle: 0, dist: 0 };+ if (!overlay?.origin) return { angle: 0, dist: 0 };const [ox, oy] = toPx(overlay.origin, size.w, size.h);const [px, py] = toPx(p, size.w, size.h);// Screen y grows downward and world y upward, so the angle is negated to@@ -113,12 +113,14 @@ export function PlayOverlay({ interactive }: Props) {const axis = data?.axis as 'x' | 'y' | undefined;// A press grabs the selection only on a HANDLE or inside the outline; a// handle says so itself, because a rotate ring sits well outside the thing- // it turns. Anywhere else selects whatever is under the pointer.- const onIt = data?.grab != null || axis != null || (overlay != null && grabbed(overlay, p, size));+ // it turns. Anywhere else selects whatever is under the pointer. A box with+ // no origin has nothing to grab at all — it is where the layout put it.+ const anchor = overlay?.origin;+ const onIt = anchor != null && (data?.grab != null || axis != null || grabbed(overlay!, anchor, p, size));const polar = polarOf(p);drag.current = {- dx: overlay ? overlay.origin.x - p.x : 0,- dy: overlay ? overlay.origin.y - p.y : 0,+ dx: anchor ? anchor.x - p.x : 0,+ dy: anchor ? anchor.y - p.y : 0,axis,moved: false,pickOnly: !onIt,@@ -171,7 +173,7 @@ export function PlayOverlay({ interactive }: Props) {};const box = overlay && size.w > 0 ? overlay : null;- const origin = box ? toPx(box.origin, size.w, size.h) : null;+ const origin = box?.origin ? toPx(box.origin, size.w, size.h) : null;const outline = box && box.corners.length === 4? box.corners.map((c) => toPx(c, size.w, size.h).join(',')).join(' '): null;@@ -185,10 +187,10 @@ export function PlayOverlay({ interactive }: Props) {onPointerUp={onPointerUp}onPointerCancel={() => { drag.current = null; }}>- {origin && (+ {(origin || outline) && (<svg className="play-ov__svg" width={size.w} height={size.h} aria-hidden="true">{outline && <polygon className="play-ov__box" points={outline} />}- {interactive && tool === 'move' && (+ {origin && interactive && tool === 'move' && (<><line className="play-ov__axis x" x1={origin[0]} y1={origin[1]} x2={origin[0] + ARM} y2={origin[1]} /><line className="play-ov__axis y" x1={origin[0]} y1={origin[1]} x2={origin[0]} y2={origin[1] - ARM} />@@ -196,10 +198,10 @@ export function PlayOverlay({ interactive }: Props) {<rect className="play-ov__grab y" data-grab="move" data-axis="y" x={origin[0] - 6} y={origin[1] - ARM - 2} width={12} height={16} /></>)}- {interactive && tool === 'rotate' && (+ {origin && interactive && tool === 'rotate' && (<circle className="play-ov__ring" data-grab="rotate" cx={origin[0]} cy={origin[1]} r={ARM} />)}- {interactive && tool === 'scale' && (+ {origin && interactive && tool === 'scale' && (<><line className="play-ov__axis x" x1={origin[0]} y1={origin[1]} x2={origin[0] + ARM} y2={origin[1]} /><line className="play-ov__axis y" x1={origin[0]} y1={origin[1]} x2={origin[0]} y2={origin[1] - ARM} />@@ -207,14 +209,16 @@ export function PlayOverlay({ interactive }: Props) {<rect className="play-ov__box-end y" data-grab="scale" x={origin[0] - 5} y={origin[1] - ARM - 5} width={10} height={10} /></>)}- <rect- className="play-ov__origin"- data-grab="move"- x={origin[0] - HANDLE}- y={origin[1] - HANDLE}- width={HANDLE * 2}- height={HANDLE * 2}- />+ {origin && (+ <rect+ className="play-ov__origin"+ data-grab="move"+ x={origin[0] - HANDLE}+ y={origin[1] - HANDLE}+ width={HANDLE * 2}+ height={HANDLE * 2}+ />+ )}</svg>)}</div>diff --git a/desktop/src/playHost.ts b/desktop/src/playHost.tsindex e3c2335ee..1e986370e 100644--- a/desktop/src/playHost.ts+++ b/desktop/src/playHost.ts@@ -14,7 +14,7 @@* Everything is same-origin estella:// (host, sdk, bundle, wasm, assets),* sidestepping the custom-scheme cross-fetch ban.*/-import { uiPickWorld, uiWorldToScreen, createWebApp, setEditorMode, setPlayMode, enableSceneOrigins, sceneOriginOf, entityWorldBox, entityBoxCorners, CameraView, layerOrderOf, quaternionToAngle2D, initPlayRealmRuntime, getComponent, clearUserComponents, getUserComponentFingerprint, probeRegistrations, Net, MessagePortTransport, Assets, Ads, createMockAdProvider, Leaderboard, createLocalLeaderboard, registerPackagedSideModules, Input, inputEventCallbacks, isEntityVisible, setEntityVisible, hasVisibility, takeCensus } from 'esengine';+import { uiPickWorld, uiWorldToScreen, screenToUiWorld, uiNodeWorldBox, createWebApp, setEditorMode, setPlayMode, enableSceneOrigins, sceneOriginOf, entityWorldBox, entityBoxCorners, CameraView, layerOrderOf, quaternionToAngle2D, initPlayRealmRuntime, getComponent, clearUserComponents, getUserComponentFingerprint, probeRegistrations, Net, MessagePortTransport, Assets, Ads, createMockAdProvider, Leaderboard, createLocalLeaderboard, registerPackagedSideModules, Input, inputEventCallbacks, isEntityVisible, setEntityVisible, hasVisibility, takeCensus } from 'esengine';import type { App, SceneData, InputState, UICameraData } from 'esengine';import type { ESEngineModule } from 'esengine/wasm';import { PLAY_PROTOCOL_VERSION } from './engine/playProtocol';@@ -198,9 +198,30 @@ const denormalizePoint = (nx: number, ny: number): { x: number; y: number } => (y: (1 - ny) * canvas.height,});+/** The UI camera this realm lays screen-space UI out with, if it has one. */+function uiCamera(): UICameraData | null {+ const cam = app?.getResourceByName('UICameraInfo') as UICameraData | undefined;+ return cam?.valid ? cam : null;+}++/** Where a UI node is drawn: its layout box, through the camera that composed it.+ * No origin — the box is the layout's answer, with no position field to drag. */+function uiOverlayBoxOf(world: App['world'], entity: number): PlayOverlayBox | null {+ const cam = uiCamera();+ const box = cam ? uiNodeWorldBox(world, entity as never) : null;+ if (!cam || !box) return null;+ const corners = entityBoxCorners(box).map((c) => {+ const s = uiWorldToScreen(cam, c.x, c.y);+ return normalizePoint(s.x, s.y);+ });+ return { corners };+}+/** Where `entity` is drawn, for the editor's overlay. Null when it has no place- * on screen — no transform, a UI node, or no camera to project through. */+ * on screen — no transform, or no camera to project through. */function overlayBoxOf(world: App['world'], entity: number): PlayOverlayBox | null {+ const ui = uiOverlayBoxOf(world, entity);+ if (ui) return ui;const view = app?.getResource(CameraView);const transformDef = getComponent('Transform');if (!view || !transformDef) return null;@@ -222,13 +243,20 @@ function overlayBoxOf(world: App['world'], entity: number): PlayOverlayBox | nulreturn { corners: corners.length === 4 ? corners : [], origin: normalizePoint(originScreen.x, originScreen.y) };}-/** The topmost entity at a canvas point, ranked the way the frame stacked it. */+/** The topmost entity at a canvas point, ranked the way the frame stacked it.+ * UI first: it is drawn over the world and hit-tested in its own space. */function pickAt(world: App['world'], nx: number, ny: number): number | null {+ const gl = denormalizePoint(nx, ny);+ const uiCam = uiCamera();+ if (uiCam) {+ const wp = screenToUiWorld(uiCam, gl.x, gl.y);+ const hit = uiPickWorld(world, wp.x, wp.y);+ if (hit !== null) return hit as never as number;+ }const view = app?.getResource(CameraView);const transformDef = getComponent('Transform');const spriteDef = getComponent('Sprite');if (!view || !transformDef) return null;- const gl = denormalizePoint(nx, ny);const hits: PickCandidate<number>[] = [];for (const e of world.getAllEntities()) {const id = e as never as number;diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.jsonindex c369d2c7d..04958dfd1 100644--- a/docs/astro/src/data/apiStability.generated.json+++ b/docs/astro/src/data/apiStability.generated.json@@ -3,10 +3,10 @@"counts": {"public": 112,"beta": 60,- "experimental": 1496,+ "experimental": 1498,"deprecated": 3},- "total": 1668,+ "total": 1670,"subsystems": [{"id": "ecs",diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex 65212aa51..c3a22295f 100644--- a/sdk/etc/index.api.md+++ b/sdk/etc/index.api.md@@ -1,7 +1,7 @@# API surface — esengine/index<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 112 public · 53 beta · 1381 experimental · 3 deprecated+Symbols: 112 public · 53 beta · 1383 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -3660,6 +3660,11 @@ getItemRect: (index: number) => RectgetVisibleRange: (viewport: Rect, count: number) => [start: number, end: number]```+## LayoutWorld — type @experimental+```+ReadableWorld & Pick<World, 'getCppRegistry' | 'getWasmModule'>+```+## Leaderboard — const @experimental```ResourceDef<LeaderboardAPI>@@ -11265,6 +11270,11 @@ UILayoutPluginUIMaskPlugin```+## uiNodeWorldBox — function @experimental+```+(world: LayoutWorld, entity: Entity): EntityBox | null+```+## uiPickAllWorld — function @experimental```(world: PickableWorld, worldX: number, worldY: number): Entity[]diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex cbab95820..2751e1cbc 100644--- a/sdk/etc/index.native.api.md+++ b/sdk/etc/index.native.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.native<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 112 public · 58 beta · 1400 experimental · 3 deprecated+Symbols: 112 public · 58 beta · 1402 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -3668,6 +3668,11 @@ getItemRect: (index: number) => RectgetVisibleRange: (viewport: Rect, count: number) => [start: number, end: number]```+## LayoutWorld — type @experimental+```+ReadableWorld & Pick<World, 'getCppRegistry' | 'getWasmModule'>+```+## Leaderboard — const @experimental```ResourceDef<LeaderboardAPI>@@ -11508,6 +11513,11 @@ UILayoutPluginUIMaskPlugin```+## uiNodeWorldBox — function @experimental+```+(world: LayoutWorld, entity: Entity): EntityBox | null+```+## uiPickAllWorld — function @experimental```(world: PickableWorld, worldX: number, worldY: number): Entity[]diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex 1d7094fb3..5c4d9facb 100644--- a/sdk/etc/index.node.api.md+++ b/sdk/etc/index.node.api.md@@ -1,7 +1,7 @@# API surface — esengine/index.node<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 112 public · 55 beta · 1380 experimental · 3 deprecated+Symbols: 112 public · 55 beta · 1382 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -3655,6 +3655,11 @@ getItemRect: (index: number) => RectgetVisibleRange: (viewport: Rect, count: number) => [start: number, end: number]```+## LayoutWorld — type @experimental+```+ReadableWorld & Pick<World, 'getCppRegistry' | 'getWasmModule'>+```+## Leaderboard — const @experimental```ResourceDef<LeaderboardAPI>@@ -11270,6 +11275,11 @@ UILayoutPluginUIMaskPlugin```+## uiNodeWorldBox — function @experimental+```+(world: LayoutWorld, entity: Entity): EntityBox | null+```+## uiPickAllWorld — function @experimental```(world: PickableWorld, worldX: number, worldY: number): Entity[]diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex d4bba907c..f0c482001 100644--- a/sdk/etc/minigame.api.md+++ b/sdk/etc/minigame.api.md@@ -1,7 +1,7 @@# API surface — esengine/minigame<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 112 public · 53 beta · 1401 experimental · 3 deprecated+Symbols: 112 public · 53 beta · 1403 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -3655,6 +3655,11 @@ getItemRect: (index: number) => RectgetVisibleRange: (viewport: Rect, count: number) => [start: number, end: number]```+## LayoutWorld — type @experimental+```+ReadableWorld & Pick<World, 'getCppRegistry' | 'getWasmModule'>+```+## Leaderboard — const @experimental```ResourceDef<LeaderboardAPI>@@ -11520,6 +11525,11 @@ UILayoutPluginUIMaskPlugin```+## uiNodeWorldBox — function @experimental+```+(world: LayoutWorld, entity: Entity): EntityBox | null+```+## uiPickAllWorld — function @experimental```(world: PickableWorld, worldX: number, worldY: number): Entity[]diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex 6c284db7d..3901dfd8b 100644--- a/sdk/etc/wechat.api.md+++ b/sdk/etc/wechat.api.md@@ -1,7 +1,7 @@# API surface — esengine/wechat<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->-Symbols: 112 public · 53 beta · 1391 experimental · 3 deprecated+Symbols: 112 public · 53 beta · 1393 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -3662,6 +3662,11 @@ getItemRect: (index: number) => RectgetVisibleRange: (viewport: Rect, count: number) => [start: number, end: number]```+## LayoutWorld — type @experimental+```+ReadableWorld & Pick<World, 'getCppRegistry' | 'getWasmModule'>+```+## Leaderboard — const @experimental```ResourceDef<LeaderboardAPI>@@ -11292,6 +11297,11 @@ UILayoutPluginUIMaskPlugin```+## uiNodeWorldBox — function @experimental+```+(world: LayoutWorld, entity: Entity): EntityBox | null+```+## uiPickAllWorld — function @experimental```(world: PickableWorld, worldX: number, worldY: number): Entity[]diff --git a/sdk/src/core-sys.ts b/sdk/src/core-sys.tsindex b4ab3a670..5b0b8d378 100644--- a/sdk/src/core-sys.ts+++ b/sdk/src/core-sys.ts@@ -61,7 +61,7 @@ export {export { setEntityVisible, isEntityVisible, hasVisibility, setEntityActive, isEntityActive } from './ecs/entityUtils';-export { entityWorldBox, entityBoxCorners, type EntityBox, type EntityBoxOptions, type ReadableWorld } from './ecs/entityBox';+export { entityWorldBox, uiNodeWorldBox, entityBoxCorners, type EntityBox, type EntityBoxOptions, type ReadableWorld, type LayoutWorld } from './ecs/entityBox';export { CacheBitmap, type BitmapCache } from './render/cacheBitmap';export {CacheAsBitmap,diff --git a/sdk/src/ecs/entityBox.ts b/sdk/src/ecs/entityBox.tsindex fd7863d92..17f87eda3 100644--- a/sdk/src/ecs/entityBox.ts+++ b/sdk/src/ecs/entityBox.ts@@ -14,6 +14,7 @@ import type { World } from './world';import { Transform, Sprite } from './component';import { UINode } from '../ui/core/ui-node';import { quaternionToAngle2D } from '../ui/util/math';+import { worldEngineApi } from './bridge/engineApi';/*** The three reads a box derivation needs — so an editor's read-only projection@@ -93,6 +94,40 @@ export function entityWorldBox(world: ReadableWorld, entity: Entity, opts?: Enti};}+/**+ * What a UI box derivation needs on top of the reads: a laid-out size lives in+ * the engine core, not in a component.+ *+ * @experimental+ */+export type LayoutWorld = ReadableWorld & Pick<World, 'getCppRegistry' | 'getWasmModule'>;++/**+ * The world box of a UI node's resolved layout — {@link entityWorldBox} for the+ * space UI lives in. Null for anything that is not a laid-out UI node.+ *+ * @experimental+ */+export function uiNodeWorldBox(world: LayoutWorld, entity: Entity): EntityBox | null {+ if (!world.valid(entity) || !world.has(entity, UINode) || !world.has(entity, Transform)) return null;+ const engine = worldEngineApi(world);+ const registry = world.getCppRegistry();+ if (!registry || !engine?.uiNode_computedWidth || !engine.uiNode_computedHeight) return null;++ const t = world.get(entity, Transform);+ const w = engine.uiNode_computedWidth(registry, entity) * t.worldScale.x;+ const h = engine.uiNode_computedHeight(registry, entity) * t.worldScale.y;+ if (!(w > 0) || !(h > 0)) return null;+ const r = t.worldRotation as { z: number; w: number };+ return {+ cx: t.worldPosition.x,+ cy: t.worldPosition.y,+ hw: Math.abs(w) / 2,+ hh: Math.abs(h) / 2,+ rot: quaternionToAngle2D(r.z, r.w),+ };+}+/*** The box's four corners in world units, counter-clockwise from its local* -x,-y — what an outline is drawn through.diff --git a/sdk/tests/entity-box.test.ts b/sdk/tests/entity-box.test.tsindex f7f7da363..09f4d87c3 100644--- a/sdk/tests/entity-box.test.ts+++ b/sdk/tests/entity-box.test.ts@@ -8,7 +8,7 @@* sitting beside its sprite is made of. One definition, these claims.*/import { describe, expect, it } from 'vitest';-import { entityWorldBox, entityBoxCorners } from '../src/ecs/entityBox';+import { entityWorldBox, entityBoxCorners, uiNodeWorldBox } from '../src/ecs/entityBox';import { Transform, Sprite } from '../src/ecs/component';import { UINode } from '../src/ui/core/ui-node';import type { Entity } from '../src/types';@@ -31,6 +31,12 @@ const T = (x: number, y: number, sx = 1, sy = 1, angle = 0) => ({worldRotation: { x: 0, y: 0, z: Math.sin(angle / 2), w: Math.cos(angle / 2) },});+/** The engine side of a UI box: a resolved layout size, in the core's own tables. */+const layout = (w: number, h: number) => ({+ getCppRegistry: () => ({}),+ getWasmModule: () => ({ uiNode_computedWidth: () => w, uiNode_computedHeight: () => h }),+});+const name = (c: unknown): string => (c as { _name?: string })._name ?? (c as { name: string }).name;const ent = (n: number) => n as unknown as Entity;@@ -81,6 +87,23 @@ describe('an entity world box', () => {expect(entityWorldBox(fakeWorld({}), ent(9))).toBeNull();});+ it('is not where a UI node is: that box comes from the layout', () => {+ const rows = { 1: { [name(Transform)]: T(0, 0, 2, 1), [name(UINode)]: {} } };+ const world = { ...fakeWorld(rows) as object, ...layout(120, 40) } as never;+ expect(entityWorldBox(world, ent(1))).toBeNull();+ // Scaled like any other box, centred on the transform: layout gives size,+ // the transform gives place.+ expect(uiNodeWorldBox(world, ent(1))).toEqual({ cx: 0, cy: 0, hw: 120, hh: 20, rot: 0 });+ });++ it('has no UI box for something that is not a laid-out UI node', () => {+ const sprite = { 1: { [name(Transform)]: T(0, 0), [name(Sprite)]: { size: { x: 10, y: 10 } } } };+ expect(uiNodeWorldBox({ ...fakeWorld(sprite) as object, ...layout(120, 40) } as never, ent(1))).toBeNull();+ // A node the layout has not sized yet has no box to outline or hit-test.+ const node = { 1: { [name(Transform)]: T(0, 0), [name(UINode)]: {} } };+ expect(uiNodeWorldBox({ ...fakeWorld(node) as object, ...layout(0, 0) } as never, ent(1))).toBeNull();+ });+it('walks its corners counter-clockwise from the local -x,-y', () => {const corners = entityBoxCorners({ cx: 0, cy: 0, hw: 2, hh: 1, rot: 0 });expect(corners).toEqual([