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): transform gizmo was invisible (0-size SVG viewport)
esengined64560da6fa6
diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsxindex d229894fa..8dfbe3c0e 100644--- a/desktop/src/panels/Viewport.tsx+++ b/desktop/src/panels/Viewport.tsx@@ -38,6 +38,13 @@ const toInput = (e: ReactPointerEvent): PointerInput => ({// gizmo.ts (GIZMO constants) so the handles a user aims at are the handles the tool// hit-tests. Screen y is down, so the world +Y handle points up (negative y). Only// move/rotate/scale render a gizmo; the select tool shows just the selection outline.+// The SVG spans a fixed square centered on the pivot (viewBox origin = 0,0 =+// pivot), sized to contain the longest handle. A real coordinate space beats the+// old width/height=0 + overflow:visible trick, which Chromium won't paint outside+// a zero-size SVG viewport (the gizmo was drawn but invisible).+const GIZMO_SVG = 180;+const gizmoViewBox = `${-GIZMO_SVG / 2} ${-GIZMO_SVG / 2} ${GIZMO_SVG} ${GIZMO_SVG}`;+function GizmoOverlay({ tool, active }: { tool: ToolMode; active: GizmoAxis | null }) {const L = GIZMO.axisLen;const B = GIZMO.boxSize;@@ -52,7 +59,7 @@ function GizmoOverlay({ tool, active }: { tool: ToolMode; active: GizmoAxis | nuconst planeOp = (on: boolean) => (on ? 1 : 0.85);if (tool === 'rotate') {return (- <svg className="gizmo-svg" width="0" height="0" overflow="visible">+ <svg className="gizmo-svg" width={GIZMO_SVG} height={GIZMO_SVG} viewBox={gizmoViewBox}><circle cx="0" cy="0" r={GIZMO.ringRadius} fill="none" stroke="var(--run)" strokeWidth={active ? 3.5 : 2} /><circle cx="0" cy="0" r="2.5" fill="var(--star)" /></svg>@@ -60,7 +67,7 @@ function GizmoOverlay({ tool, active }: { tool: ToolMode; active: GizmoAxis | nu}if (tool === 'scale') {return (- <svg className="gizmo-svg" width="0" height="0" overflow="visible">+ <svg className="gizmo-svg" width={GIZMO_SVG} height={GIZMO_SVG} viewBox={gizmoViewBox}><line x1="0" y1="0" x2={L} y2="0" stroke="var(--error)" strokeWidth={axW(onX)} /><rect x={L - B / 2} y={-B / 2} width={B} height={B} fill="var(--error)" opacity={onX ? 1 : 0.95} /><line x1="0" y1="0" x2="0" y2={-L} stroke="var(--run)" strokeWidth={axW(onY)} />@@ -71,7 +78,7 @@ function GizmoOverlay({ tool, active }: { tool: ToolMode; active: GizmoAxis | nu}// move (and any other) → axis arrows + a center plane squarereturn (- <svg className="gizmo-svg" width="0" height="0" overflow="visible">+ <svg className="gizmo-svg" width={GIZMO_SVG} height={GIZMO_SVG} viewBox={gizmoViewBox}><line x1="0" y1="0" x2={L} y2="0" stroke="var(--error)" strokeWidth={axW(onX)} /><path d={`M${L} 0 L${L - 9} -4 L${L - 9} 4 Z`} fill="var(--error)" opacity={onX ? 1 : 0.95} /><line x1="0" y1="0" x2="0" y2={-L} stroke="var(--run)" strokeWidth={axW(onY)} />diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.cssindex b7fe5f037..3d97752b9 100644--- a/desktop/src/theme/app.css+++ b/desktop/src/theme/app.css@@ -561,10 +561,13 @@will-change: transform, opacity;transition: opacity 0.1s ease;}-/* The interactive gizmo draws from its origin (= the pivot the wrapper is- translated to), so no centering transform — just the contrast shadow. */+/* The gizmo SVG is a fixed square whose viewBox is centered on (0,0); place that+ center at the wrapper origin (= the pivot) by pulling it back half its size. */.viewport__gizmo svg {- display: block;+ position: absolute;+ left: 0;+ top: 0;+ transform: translate(-50%, -50%);overflow: visible;filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.55));}