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(ui): live nest-target outline while dragging a widget over the viewport
esengine016958185e2e
diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsxindex d91167b91..ab8813a11 100644--- a/desktop/src/panels/Viewport.tsx+++ b/desktop/src/panels/Viewport.tsx@@ -1716,10 +1716,36 @@ export function Viewport() {e.dataTransfer.types.includes('application/x-estella-asset') ||e.dataTransfer.types.includes(SOURCE_DND_MIME);+ const dropHintRef = useRef<HTMLDivElement>(null);+ const hideDropHint = () => { if (dropHintRef.current) dropHintRef.current.style.opacity = '0'; };+const onDragOver = (e: ReactDragEvent) => {if (!isAssetDrag(e)) return;e.preventDefault();e.dataTransfer.dropEffect = 'copy';+ // Live nest-target feedback for palette drags: outline the container the widget+ // would nest into. The Canvas root gets no outline — an empty-area drop reads+ // as before. (Drag data VALUES are sealed during dragover; types are readable.)+ const hint = dropHintRef.current;+ if (!hint) return;+ let r: { x: number; y: number; w: number; h: number } | null = null;+ if (e.dataTransfer.types.includes(SOURCE_DND_MIME)) {+ const src = uiDropParent(e.clientX, e.clientY);+ const comps = src != null ? SceneModel.entityBySource(src)?.components : undefined;+ if (src != null && comps && !comps.some((c) => c.type === 'Canvas')) {+ const rt = SceneModel.runtimeFor(src);+ const obb = rt != null ? ViewportController.uiEntityWorldOBB(rt) : null;+ if (obb) r = worldRectToScreen(obb.cx, obb.cy, obb.hw, obb.hh);+ }+ }+ if (r) {+ hint.style.opacity = '1';+ hint.style.transform = `translate(${r.x}px, ${r.y}px)`;+ hint.style.width = `${r.w}px`;+ hint.style.height = `${r.h}px`;+ } else {+ hint.style.opacity = '0';+ }};// The deepest plain layout container under the pointer — the drop parent for a@@ -1740,6 +1766,7 @@ export function Viewport() {};const onDrop = (e: ReactDragEvent) => {+ hideDropHint();// A widget dragged from the UI palette: create it at the drop point — nested// in the container under the pointer when there is one, else under the Canvas// via its placement rule — and select it.@@ -1947,6 +1974,7 @@ export function Viewport() {onPointerLeave={() => { StatsStore.clearCursor(); StatsStore.clearTile(); hoverTileRef.current = null; }}onContextMenu={(e) => e.preventDefault()}onDragOver={onDragOver}+ onDragLeave={hideDropHint}onDrop={onDrop}/>@@ -2231,6 +2259,7 @@ export function Viewport() {))}</div><div ref={tilePaintRef} className="viewport__tilepaint" aria-hidden="true" />+ <div ref={dropHintRef} className="viewport__drophint" style={{ opacity: 0 }} aria-hidden="true" /><svg ref={designSvgRef} className="viewport__design-svg" style={{ opacity: 0 }} aria-hidden="true"><path className="df-letterbox" fillRule="evenodd" />diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.cssindex 483be6b97..afa23fa8e 100644--- a/desktop/src/theme/app.css+++ b/desktop/src/theme/app.css@@ -215,6 +215,21 @@.viewport__selection.primary {border-width: 1.5px;}+/* Nest-target hint while dragging a widget from the palette — the container the+ drop would parent into. Accent (UI chrome blue), distinct from the orange+ selection outline. */+.viewport__drophint {+ position: absolute;+ top: 0;+ left: 0;+ z-index: 4;+ opacity: 0;+ pointer-events: none;+ border: 1.5px dashed var(--acc);+ background: var(--acc-soft);+ border-radius: 2px;+ will-change: transform, width, height, opacity;+}/* Box-select marquee (rAF-driven by the transform tool's empty-space drag). */.viewport__marquee {position: absolute;diff --git a/desktop/src/theme/viewport.css b/desktop/src/theme/viewport.cssindex b68425ce4..c14503cf8 100644--- a/desktop/src/theme/viewport.css+++ b/desktop/src/theme/viewport.css@@ -209,6 +209,7 @@.viewport--play .viewport__gizmo,.viewport--play .viewport__ui-gizmo,.viewport--play .viewport__marquee,+.viewport--play .viewport__drophint,.viewport--play .viewport__tilesel,.viewport--play .viewport__tilepreview,.viewport--play .viewport__tileghost,