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): a light's shapes are drawn, and drawn through the view
esengineb7dc9b7786f7
diff --git a/desktop/scripts/editor-checks/icon-pick.mjs b/desktop/scripts/editor-checks/icon-pick.mjsindex 2ff3548b6..2320e9723 100644--- a/desktop/scripts/editor-checks/icon-pick.mjs+++ b/desktop/scripts/editor-checks/icon-pick.mjs@@ -16,7 +16,7 @@*/import { cp } from 'node:fs/promises';import path from 'node:path';-import { makeProject, checker, DESKTOP } from '../lib/editorDriver.mjs';+import { makeProject, checker, originIn, viewportRegion, DESKTOP } from '../lib/editorDriver.mjs';const EXAMPLE = path.resolve(DESKTOP, '..', 'examples', 'sprite-rendering');@@ -45,31 +45,6 @@ const SCENE = JSON.stringify({export const name = 'icon-pick';export const describes = 'an entity drawn as an icon is clickable where the icon is';-/**- * Where the grid's coloured axis lines are, which is where the world origin projects- * — independent of what the editor draws over it. They are blended at 55% over an- * unknown background, so the ARGMAX identifies the line rather than any exact value.- */-function axisAt(png, rgb, vertical, region) {- const tally = new Array(vertical ? png.w : png.h).fill(0);- for (let y = region.y0; y < region.y1; y++) {- for (let x = region.x0; x < region.x1; x++) {- const p = png.px(x, y);- // The line is the channel ORDER, not the exact value: alpha over an unknown- // background moves every channel but keeps which one leads.- const lead = p[0] > p[1] && p[0] > p[2];- const isGreen = p[1] > p[0] && p[1] > p[2];- if ((rgb === 'red' && lead && p[0] > 60) || (rgb === 'green' && isGreen && p[1] > 60)) {- tally[vertical ? x : y] += 1;- }- }- }- let best = -1;- let at = -1;- tally.forEach((n, i) => { if (n > best) { best = n; at = i; } });- return best > 20 ? at : -1;-}-export async function run(ed) {const root = await makeProject({'assets/scenes/main.esscene': SCENE,@@ -86,14 +61,11 @@ export async function run(ed) {await ed.sleep(800);const shot = await ed.screenshot('icon-pick');- // The viewport, roughly — enough to keep the panels' own colours out of the tally.- const region = { x0: Math.round(shot.w * 0.25), x1: Math.round(shot.w * 0.72),- y0: Math.round(shot.h * 0.16), y1: Math.round(shot.h * 0.62) };- const cx = axisAt(shot, 'green', true, region);- const cy = axisAt(shot, 'red', false, region);- if (!check(cx > 0 && cy > 0, `the grid's axis lines were not found (x=${cx}, y=${cy})`)) {+ const origin = originIn(shot, viewportRegion(shot));+ if (!check(origin != null, "the grid's axis lines were not found — the camera is at the origin")) {return check.failures;}+ const { x: cx, y: cy } = origin;const at = async (dx, dy) => ed.json('pick', { clientX: cx + dx, clientY: cy + dy }, 30000);const centre = await at(0, 0);diff --git a/desktop/scripts/editor-checks/light-aim.mjs b/desktop/scripts/editor-checks/light-aim.mjsnew file mode 100644index 000000000..f019164e6--- /dev/null+++ b/desktop/scripts/editor-checks/light-aim.mjs@@ -0,0 +1,104 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file light-aim — a light's aim arrow is drawn through the view, like every arrow.+ *+ * A light points along its entity's forward, which is a direction in space. The+ * arrow for it has to be that direction PROJECTED, and taking the world x and y as+ * if they were the screen's is right only from the head-on eye.+ *+ * An unrotated light aims into the screen. Head-on that projects to nothing and+ * there is no arrow to draw — the honest picture. Turn the eye and the same aim+ * becomes a direction on screen, so an arrow must appear. Both claims are made: a+ * gizmo built from world x/y draws no arrow either way and fails the second.+ */+import { cp } from 'node:fs/promises';+import path from 'node:path';+import { makeProject, checker, originIn, viewportRegion, DESKTOP } from '../lib/editorDriver.mjs';++const EXAMPLE = path.resolve(DESKTOP, '..', 'examples', 'sprite-rendering');++/** One directional light at the origin, unrotated: it aims along −Z, into the screen. */+const SCENE = JSON.stringify({+ version: '1.0', name: 'Main',+ entities: [+ {+ id: 0, name: 'Sun', parent: null, children: [], visible: true,+ components: [+ { type: 'Transform', data: { position: { x: 0, y: 0, z: 0 } } },+ {+ type: 'Light2D',+ data: { type: 1, intensity: 1, enabled: true, color: { r: 1, g: 1, b: 1, a: 1 } },+ },+ ],+ },+ ],+}, null, 1);++export const name = 'light-aim';+export const describes = "a light's aim is drawn as the view sees that direction";++/** How far from `c` the gizmo toggle painted anything, in pixels. */+function reach(a, b, c, limit, tol = 25) {+ let far = 0;+ const x0 = Math.max(0, c.x - limit);+ const x1 = Math.min(Math.min(a.w, b.w), c.x + limit);+ const y0 = Math.max(0, c.y - limit);+ const y1 = Math.min(Math.min(a.h, b.h), c.y + limit);+ for (let y = y0; y < y1; y++) {+ for (let x = x0; x < x1; x++) {+ const p = a.px(x, y);+ const q = b.px(x, y);+ if (Math.abs(p[0] - q[0]) > tol || Math.abs(p[1] - q[1]) > tol || Math.abs(p[2] - q[2]) > tol) {+ far = Math.max(far, Math.hypot(x - c.x, y - c.y));+ }+ }+ }+ return far;+}++export async function run(ed) {+ const root = await makeProject({ 'assets/scenes/main.esscene': SCENE });+ await cp(path.join(EXAMPLE, 'project.esproject'), path.join(root, 'project.esproject'));+ await cp(path.join(EXAMPLE, 'src'), path.join(root, 'src'), { recursive: true });+ const check = checker();+ await ed.open(root, 'assets/scenes/main.esscene');+ // The design overlay belongs to UI mode, and the editor remembers its mode.+ await ed.call('run_editor_command', { id: 'mode.scene' }, 30000);+ await ed.call('select', { id: null }, 30000);+ await ed.sleep(800);++ /** How far the light's chrome reaches from `at`, for the current eye. */+ const measure = async (label, at) => {+ await ed.call('run_editor_command', { id: 'view.toggleGizmos' }, 30000);+ await ed.sleep(700);+ const off = await ed.screenshot(`${label}-off`);+ await ed.call('run_editor_command', { id: 'view.toggleGizmos' }, 30000);+ await ed.sleep(700);+ const on = await ed.screenshot(`${label}-on`);+ return { reach: reach(off, on, at ?? originIn(on, viewportRegion(on)), 70), shot: on };+ };++ const first = await ed.screenshot('light-aim-locate');+ // The light is at the origin, which is the view's focus, and the eye turns ABOUT+ // the focus — so this point serves both eyes, and only the head-on grid has the+ // straight axis lines it is read from.+ const origin = originIn(first, viewportRegion(first));+ if (!check(origin != null, "the grid's axis lines were not found — the light is at the origin")) {+ return check.failures;+ }+ const flat = (await measure('light-aim-flat', origin)).reach;+ // Head-on the light aims at the eye: an icon and nothing else.+ check(flat < 20, `head-on the light's chrome reaches ${flat.toFixed(0)}px, past its own icon — `+ + 'an aim pointing at the eye is being drawn as a direction it does not have');++ await ed.call('run_editor_command', { id: 'view.toggleViewPerspective' }, 30000);+ await ed.sleep(1200);+ const turned = (await measure('light-aim-turned', origin)).reach;+ // The arrow is drawn a fixed 38px long, so from a turned eye the chrome reaches+ // well past the icon it reached to before.+ check(turned > 25, `from a turned eye the light's chrome reaches only ${turned.toFixed(0)}px — `+ + 'the aim is not being projected, so a direction into the screen stays invisible');++ return check.failures;+}diff --git a/desktop/scripts/lib/editorDriver.mjs b/desktop/scripts/lib/editorDriver.mjsindex 3126cf1e2..f74259f26 100644--- a/desktop/scripts/lib/editorDriver.mjs+++ b/desktop/scripts/lib/editorDriver.mjs@@ -211,6 +211,41 @@ export async function withEditor(body, opts = {}) {}}+/**+ * Where the world origin projects, read off the grid's own coloured axis lines —+ * independent of whatever the editor draws over them. `region` keeps the panels out+ * of the tally. The lines are blended over an unknown background, so one is+ * identified by which channel LEADS and by the argmax, never by an exact colour.+ */+export function originIn(png, region) {+ const axis = (wantRed, vertical) => {+ const tally = new Array(vertical ? png.w : png.h).fill(0);+ for (let y = region.y0; y < region.y1; y++) {+ for (let x = region.x0; x < region.x1; x++) {+ const p = png.px(x, y);+ const leadsRed = p[0] > p[1] && p[0] > p[2] && p[0] > 60;+ const leadsGreen = p[1] > p[0] && p[1] > p[2] && p[1] > 60;+ if (wantRed ? leadsRed : leadsGreen) tally[vertical ? x : y] += 1;+ }+ }+ let best = -1;+ let at = -1;+ tally.forEach((n, i) => { if (n > best) { best = n; at = i; } });+ return best > 20 ? at : -1;+ };+ const x = axis(false, true); // the +Y axis line runs vertically, and is green+ const y = axis(true, false); // the +X axis line runs horizontally, and is red+ return x >= 0 && y >= 0 ? { x, y } : null;+}++/** The viewport, roughly — enough of it to read the grid without the panels. */+export function viewportRegion(png) {+ return {+ x0: Math.round(png.w * 0.25), x1: Math.round(png.w * 0.72),+ y0: Math.round(png.h * 0.16), y1: Math.round(png.h * 0.62),+ };+}+/** Collect failures without stopping at the first: one run, every claim tested. */export function checker() {const failures = [];diff --git a/desktop/src/engine/ViewportController.ts b/desktop/src/engine/ViewportController.tsindex f051cf242..9b2252dd8 100644--- a/desktop/src/engine/ViewportController.ts+++ b/desktop/src/engine/ViewportController.ts@@ -35,7 +35,9 @@ import {obbCorners,rectsIntersect,screenAABB,+ screenDir,screenHull,+ HEAD_ON,worldToLocal3D,} from './viewportMath';@@ -47,10 +49,10 @@ const JOINT3D_AXIS_WORLD_HALF = 60;const ICON_PICK_SCREEN_HALF = 11;// The room a MAP, or "Frame", gives such a marker: world units, fixed under zoom.const ICON_MAP_WORLD_HALF = 24;-// Degrees of turn per pixel dragged — the rate a DCC's orbit uses.// How square-on the work plane has to be before a screen point names a place on it// rather than a mile of it. ~6°, below which one pixel of cursor is unbounded world.const WORK_PLANE_MIN_FACING = 0.1;+// Degrees of turn per pixel dragged — the rate a DCC's orbit uses.const ORBIT_DEG_PER_PX = 0.4;// The scene-authored joint components, each drawn as an anchor-to-anchor link gizmo.@@ -400,15 +402,23 @@ export const ViewportController = {return entityWorldBox(world, id, { iconHalf: iconHalf ?? this.iconPickHalf() });},- /** The world half-size an icon covers where it stands, for the zoom it is drawn- * at — what a click has to hit. */- iconPickHalf(): (at: Vec3) => number {+ /** World units per screen pixel where `at` stands — what a world length measures+ * on screen there, and what a screen size measures in the world. */+ worldPerPixelAt(at: Vec3): number {const view = editorView();const canvas = EngineHost.canvas;const dpr = window.devicePixelRatio || 1;const heightPx = canvas ? canvas.height / dpr : 0;- if (!view || heightPx <= 0) return () => ICON_MAP_WORLD_HALF;- return (at) => ICON_PICK_SCREEN_HALF * editorViewWorldPerPixel(view, heightPx, at);+ return view && heightPx > 0 ? editorViewWorldPerPixel(view, heightPx, at) : 0;+ },++ /** The world half-size an icon covers where it stands, for the zoom it is drawn+ * at — what a click has to hit. */+ iconPickHalf(): (at: Vec3) => number {+ return (at) => {+ const perPixel = this.worldPerPixelAt(at);+ return perPixel > 0 ? ICON_PICK_SCREEN_HALF * perPixel : ICON_MAP_WORLD_HALF;+ };},/**@@ -1008,34 +1018,33 @@ export const ViewportController = {const center = toClient(t.worldPosition.x, t.worldPosition.y);if (!center) return null;- // Point (0) / Spot (3) have a falloff radius; project a world-radius offset to CSS px.- let radiusPx = 0;- if (l.type === 0 || l.type === 3) {- const edge = toClient(t.worldPosition.x + l.radius, t.worldPosition.y);- if (edge) radiusPx = Math.hypot(edge.x - center.x, edge.y - center.y);- }- // Directional (1) / Spot (3) aim along the entity's forward; flip world-Y to screen- // space. An aim with nothing in the plane draws no arrow, and a Spot falls back to- // down — both are what the engine's collectLights reads off the same rotation.+ const at = { x: t.worldPosition.x, y: t.worldPosition.y, z: t.worldPosition.z };+ // Point (0) / Spot (3) have a falloff radius. What a world length measures on+ // screen where the light stands — projecting an offset along ONE world axis+ // would shrink the reach whenever the eye foreshortens that axis.+ const perPixel = this.worldPerPixelAt(at);+ const radiusPx = (l.type === 0 || l.type === 3) && perPixel > 0 ? l.radius / perPixel : 0;+ // Directional (1) / Spot (3) aim along the entity's forward, projected through the+ // view like every other arrow the editor draws. An aim pointing at the eye projects+ // to nothing and draws no arrow, which is what it looks like.let sdx = 0;let sdy = 0;if (l.type === 1 || l.type === 3) {- const aim = lightAimOf(t.worldRotation);- const len = Math.hypot(aim.x, aim.y);+ const dir = screenDir(this.viewAxes() ?? HEAD_ON, lightAimOf(t.worldRotation));+ const len = Math.hypot(dir.x, dir.y);if (len > 1e-4) {- sdx = aim.x / len;- sdy = -aim.y / len;- } else if (l.type === 3) {- sdy = 1; // world (0,-1) → screen down+ sdx = dir.x / len;+ sdy = dir.y / len;}}const coneHalf = l.type === 3 ? ((l.outerAngle ?? 45) * 0.5 * Math.PI) / 180 : 0;const hex = (v: number) => Math.max(0, Math.min(255, Math.round(v * 255))).toString(16).padStart(2, '0');const color = `#${hex(l.color.r)}${hex(l.color.g)}${hex(l.color.b)}`;const on = l.enabled !== false && l.intensity > 0;- // Radius handle at the top of the reach circle (Point/Spot only — drag = radius).+ // Radius handle at the top of the reach circle as DRAWN (Point/Spot only — drag =+ // radius), rather than at a world offset that lands elsewhere from a turned eye.const handle = (l.type === 0 || l.type === 3)- ? toClient(t.worldPosition.x, t.worldPosition.y + l.radius)+ ? { x: center.x, y: center.y - radiusPx }: null;return { cx: center.x, cy: center.y, kind: l.type, color, radiusPx, sdx, sdy, coneHalf, on, handle: handle ?? null };},diff --git a/desktop/src/engine/viewportMath.ts b/desktop/src/engine/viewportMath.tsindex 1e03a7935..cb638a3ad 100644--- a/desktop/src/engine/viewportMath.ts+++ b/desktop/src/engine/viewportMath.ts@@ -119,6 +119,36 @@ export function worldToLocal3D(w: Vec3, frame: Frame3D): Vec3 {};}+/** A point in screen (CSS px) space. */+export interface Pt {+ x: number;+ y: number;+}++/** Where each world axis points on screen — see `editorViewAxes`. */+export interface ViewAxes {+ x: { dx: number; dy: number };+ y: { dx: number; dy: number };+ z: { dx: number; dy: number };+}++/** The head-on 2D view: +X right, +Y up, Z straight at the eye. */+export const HEAD_ON: ViewAxes = { x: { dx: 1, dy: 0 }, y: { dx: 0, dy: -1 }, z: { dx: 0, dy: 0 } };++/**+ * Where a world direction points on screen, in the view's own basis.+ *+ * The projection of a direction is linear in that basis, so every arrow the editor+ * draws — a gizmo handle, a ring's spanning vectors, a light's aim — is this one+ * function applied to a unit vector, and none of them writes a direction down.+ */+export function screenDir(axes: ViewAxes, v: Vec3): Pt {+ return {+ x: v.x * axes.x.dx + v.y * axes.y.dx + v.z * axes.z.dx,+ y: v.x * axes.x.dy + v.y * axes.y.dy + v.z * axes.z.dy,+ };+}+/** Whether two client rects overlap (touching edges count as overlap). */export function rectsIntersect(a: ClientRect, b: ClientRect): boolean {return a.x <= b.x + b.w && b.x <= a.x + a.w && a.y <= b.y + b.h && b.y <= a.y + a.h;diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsxindex c1849af25..c03fb2cf2 100644--- a/desktop/src/panels/Viewport.tsx+++ b/desktop/src/panels/Viewport.tsx@@ -278,6 +278,15 @@ function shapeOutline(el: SVGPolygonElement | null, sid: number | null): void {el.style.opacity = '1';}+/** Place an SVG line by its two ends. */+function setLineAttrs(el: Element | null, x1: number, y1: number, x2: number, y2: number): void {+ if (!el) return;+ el.setAttribute('x1', String(x1));+ el.setAttribute('y1', String(y1));+ el.setAttribute('x2', String(x2));+ el.setAttribute('y2', String(y2));+}+function setRectAttrs(el: Element | null, r: { x: number; y: number; w: number; h: number }): void {if (!el) return;el.setAttribute('x', String(r.x));@@ -1933,9 +1942,14 @@ export function Viewport() {wrap.style.opacity = lg.on ? '1' : '0.35';wrap.style.visibility = 'visible'; // re-enable the click target with the gizmowrap.style.color = lg.color;- wrap.style.transform = `translate(${lg.cx}px, ${lg.cy}px)`;+ // The icon moves; the shapes are drawn where they are, in the panel-wide+ // SVG's own coordinates.+ const hit = wrap.firstElementChild as HTMLElement | null;+ if (hit) hit.style.transform = `translate(${lg.cx}px, ${lg.cy}px)`;const circle = wrap.querySelector('.lg-radius') as SVGCircleElement | null;if (circle) {+ circle.setAttribute('cx', String(lg.cx));+ circle.setAttribute('cy', String(lg.cy));circle.setAttribute('r', String(lg.radiusPx));circle.style.opacity = lg.on && lg.radiusPx > 0 ? '0.6' : '0';}@@ -1943,8 +1957,7 @@ export function Viewport() {if (dir) {const hasDir = lg.sdx !== 0 || lg.sdy !== 0;const len = lg.kind === 3 ? Math.max(lg.radiusPx, 28) : 38;- dir.setAttribute('x2', String(lg.sdx * len));- dir.setAttribute('y2', String(lg.sdy * len));+ setLineAttrs(dir, lg.cx, lg.cy, lg.cx + lg.sdx * len, lg.cy + lg.sdy * len);dir.style.opacity = lg.on && hasDir ? '0.9' : '0';}// Spot (kind 3): two cone-edge lines at ±half-angle around the aim, out to the reach.@@ -1958,8 +1971,7 @@ export function Viewport() {const sa = Math.sin(a);const ex = (lg.sdx * ca - lg.sdy * sa) * lg.radiusPx;const ey = (lg.sdx * sa + lg.sdy * ca) * lg.radiusPx;- line.setAttribute('x2', String(ex));- line.setAttribute('y2', String(ey));+ setLineAttrs(line, lg.cx, lg.cy, lg.cx + ex, lg.cy + ey);line.style.opacity = '0.55';} else {line.style.opacity = '0';@@ -1970,8 +1982,8 @@ export function Viewport() {const lhnd = wrap.querySelector('.lg-handle') as SVGCircleElement | null;if (lhnd) {if (lg.on && lg.handle) {- lhnd.setAttribute('cx', String(lg.handle.x - lg.cx));- lhnd.setAttribute('cy', String(lg.handle.y - lg.cy));+ lhnd.setAttribute('cx', String(lg.handle.x));+ lhnd.setAttribute('cy', String(lg.handle.y));lhnd.style.display = '';} else {lhnd.style.display = 'none';@@ -2570,7 +2582,7 @@ export function Viewport() {><Lightbulb className="viewport__light-icon" size={14} strokeWidth={1.9} /></span>- <svg className="viewport__light-svg" width="0" height="0" overflow="visible" aria-hidden="true">+ <svg className="viewport__light-svg" aria-hidden="true"><circle className="lg-radius" cx="0" cy="0" r="0" /><line className="lg-dir" x1="0" y1="0" x2="0" y2="0" /><line className="lg-cone1" x1="0" y1="0" x2="0" y2="0" />diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.cssindex 10a933b30..5f31c6b48 100644--- a/desktop/src/theme/app.css+++ b/desktop/src/theme/app.css@@ -426,13 +426,13 @@ body.thumb-capture .viewport > :not(.viewport__stage):not(.viewport__play) {/* Light2D gizmo: the wrap is translated to the light (rAF); icon + SVG draw at its origin,tinted by the wrap's `color` (set to the light color) via currentColor. */+/* Covers the panel, like every other overlay here: its shapes reach out to a+ light's radius, and a wrapper sized to the light clips them to nothing. */.viewport__light-gizmo {position: absolute;- left: 0;- top: 0;+ inset: 0;z-index: 2;pointer-events: none;- will-change: transform;transition: opacity var(--t-fast);}/* The bulb is the light's click target (select-to-identify); generously padded hit box. */@@ -489,8 +489,9 @@ body.thumb-capture .viewport > :not(.viewport__stage):not(.viewport__play) {}.viewport__light-svg {position: absolute;- left: 0;- top: 0;+ inset: 0;+ width: 100%;+ height: 100%;overflow: visible;}.viewport__light-svg .lg-radius {diff --git a/desktop/src/tools/gizmo.ts b/desktop/src/tools/gizmo.tsindex 16ffebee8..48ac8b7ab 100644--- a/desktop/src/tools/gizmo.ts+++ b/desktop/src/tools/gizmo.ts@@ -14,38 +14,18 @@* direction, and the arrows and the rings are both made of it.*/-import { axisQuat, quatMul, rotateVec3, type Quat, type Vec3 } from '@/engine/viewportMath';+import {+ axisQuat, quatMul, rotateVec3, screenDir, HEAD_ON,+ type Quat, type Vec3, type ViewAxes, type Pt,+} from '@/engine/viewportMath';-export { axisQuat, quatMul, rotateVec3, type Quat, type Vec3 };+export { axisQuat, quatMul, rotateVec3, screenDir, HEAD_ON };+export type { Quat, Vec3, ViewAxes, Pt };export type GizmoMode = 'move' | 'rotate' | 'scale';/** What a handle constrains motion to: one world axis, or the plane of two. */export type GizmoAxis = 'x' | 'y' | 'z' | 'xy' | 'yz' | 'zx';-/** Where each world axis points on screen — see `editorViewAxes`. */-export interface ViewAxes {- x: { dx: number; dy: number };- y: { dx: number; dy: number };- z: { dx: number; dy: number };-}--/** The head-on 2D view: +X right, +Y up, Z straight at the eye. */-export const HEAD_ON: ViewAxes = { x: { dx: 1, dy: 0 }, y: { dx: 0, dy: -1 }, z: { dx: 0, dy: 0 } };--/**- * Where a world direction points on screen, in the view's own basis.- *- * The projection of a direction is linear in that basis, so every handle — an- * arrow, a ring's two spanning vectors, a local axis turned by the entity's own- * rotation — is this one function applied to a unit vector.- */-export function screenDir(axes: ViewAxes, v: Vec3): Pt {- return {- x: v.x * axes.x.dx + v.y * axes.y.dx + v.z * axes.z.dx,- y: v.x * axes.x.dy + v.y * axes.y.dy + v.z * axes.z.dy,- };-}-/** The world axis a single-axis handle constrains to. */export const AXIS_VECTOR: Record<'x' | 'y' | 'z', Vec3> = {x: { x: 1, y: 0, z: 0 },@@ -71,11 +51,6 @@ export interface GizmoHandle {axis: GizmoAxis;}-export interface Pt {- x: number;- y: number;-}-/** Screen-space layout of the gizmo (CSS px). Rendering (Viewport.tsx) mirrors these. */export const GIZMO = {axisLen: 58, // axis arrow length from the pivot