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): make the editor-mode pin a real, sticky lock
yhhdfc98bd2c1a2
diff --git a/desktop/src/App.tsx b/desktop/src/App.tsxindex 642814d0c..3b5e22226 100644--- a/desktop/src/App.tsx+++ b/desktop/src/App.tsx@@ -26,12 +26,9 @@ import { ConfirmService } from '@/components/confirm';import { overlayGuard } from '@/components/overlayGuard';import { commands } from '@/commands';import { handleTilePaintKey } from '@/tools/tileMode';-import { suggestedMode } from '@/mode/activeMode';import { useEditorMode } from '@/store/editorModeStore';import { uiPreviewAspect } from '@/mode/resolutionPresets';import { EngineHost } from '@/engine/EngineHost';-import type { EditorModeId } from '@/mode/editorModes';-import { useSelection } from '@/store/selectionStore';import { PlayRealms } from '@/engine/PlayRealm';import { PlayInspect } from '@/engine/PlayInspect';import { TimelinePreview } from '@/engine/TimelinePreview';@@ -114,20 +111,11 @@ export function App() {});}, []);- // A plain selection switches the editing mode (its tools + viewport overlays are- // derived live from activeMode()) but must NOT restructure the workspace — clicking- // to inspect a node should never fling docked panels open over what you were doing.- // Opening a mode's companion panels (the Tilemap painter, UI widgets…) is an- // EXPLICIT gesture now: click the mode chip in the viewport, the activity-bar mode- // button, or run the mode command. Entering a new mode still drops a stale pin.- useEffect(() => {- let prevMode: EditorModeId | null = null;- return useSelection.subscribe(() => {- const mode = suggestedMode();- if (mode.id !== prevMode) useEditorMode.getState().clearPin();- prevMode = mode.id;- });- }, []);+ // Note: a plain selection no longer touches the editing mode's docks or pin. The+ // mode's tools + overlays are derived live from activeMode() (pin ?? selection), so+ // selecting a node updates the SUGGESTED mode with zero side effects; a PINNED mode+ // stays a deliberate lock until you re-toggle it from the activity bar / mode chip.+ // (Opening a mode's companion panels is likewise explicit — the mode command.)// Feed the UI-mode device selection into the editor UI layout: a chosen device preset// lays UI out at its aspect (previewing adaptation), 'design' keeps the design box. Re-syncdiff --git a/desktop/src/commands/editorCommands.ts b/desktop/src/commands/editorCommands.tsindex 62d48a8e0..f5e517733 100644--- a/desktop/src/commands/editorCommands.ts+++ b/desktop/src/commands/editorCommands.ts@@ -260,7 +260,15 @@ for (const m of EDITOR_MODES) {category: t('cat.tools'),isChecked: () => activeMode().id === m.id,run: () => {- useEditorMode.getState().setMode(m.id);+ const modeStore = useEditorMode.getState();+ // The pin is a sticky mode LOCK that ordinary clicks never clear (so you can+ // paint tiles / lay out UI while selecting other things). Re-invoking the mode+ // you've already pinned toggles it OFF — back to following the selection.+ if (modeStore.pinned === m.id) {+ modeStore.clearPin();+ return;+ }+ modeStore.setMode(m.id);for (const p of m.panels ?? []) {dockApi.openSidePanel(p.id, p.component, p.title, p.side ?? 'left', p.width ?? 300);}