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(ui): keep tree selection when toggling disclosure
yhhc83729609b29
diff --git a/desktop b/desktopindex 674beda5d..caf353126 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit 674beda5d6bb08cc23acfd1138910ad27de10137+Subproject commit caf35312620c7b1d9727a2ee3f9241c8bb8da9cfdiff --git a/sdk/src/ui/widgets/tree-view.ts b/sdk/src/ui/widgets/tree-view.tsindex d05640759..8ffe46087 100644--- a/sdk/src/ui/widgets/tree-view.ts+++ b/sdk/src/ui/widgets/tree-view.ts@@ -234,9 +234,11 @@ export function installTreeViews(app: App, host: ListViewHost): () => void {markThemed(w, label, { text: 'text' }); markThemed(w, arrow, { text: 'text' });makeWidgetInteractable(w, arrow, { focusable: false });targets.set(arrow, rowEntity);- unsubs.push(events.on(arrow, UIEventType.Click, () => {+ unsubs.push(events.on(arrow, UIEventType.Click, event => {+ event.stopPropagation();if (!playing() || !available(root)) return;const id = rowIds.get(rowEntity); if (id === undefined) return;+ live.get(root)!.activeId = id;model.toggle(id); moveUIFocus(world, events, app.getResource(FocusManager), root, false);writeState(root, live.get(root)!);}));diff --git a/sdk/tests/ui-tree-color-wasm.test.ts b/sdk/tests/ui-tree-color-wasm.test.tsindex 3dff57f35..77c50c878 100644--- a/sdk/tests/ui-tree-color-wasm.test.ts+++ b/sdk/tests/ui-tree-color-wasm.test.ts@@ -121,6 +121,12 @@ describe.skipIf(!HAS_WASM)('TreeView / ColorPicker on real WASM', () => {input.mouseX=at.x+400;input.mouseY=300-at.y;input.noteMouseDown(0);await tick();input.clearFrameState();input.mouseButtons.delete(0);input.mouseButtonsReleased.add(0);await tick();expect(handle.getModel()!.selectedIds).toEqual(['a']);expect(app.getResource(FocusManager).focusedEntity).toBe(handle.entity);+ input.clearFrameState();+ const disclosure=app.world.getEntitiesWithComponents([Name]).find(e=>app.world.get(e,Name).value==='TreeDisclosure:root')!;+ const arrowAt=app.world.get(disclosure,Transform).worldPosition;+ input.mouseX=arrowAt.x+400;input.mouseY=300-arrowAt.y;input.noteMouseDown(0);await tick();input.clearFrameState();+ input.mouseButtons.delete(0);input.mouseButtonsReleased.add(0);await tick();+ expect(handle.getModel()!.getCount()).toBe(1);expect(handle.getModel()!.selectedIds).toEqual(['a']);});it('stable controls avoid rewriting unchanged visual geometry',async()=>{tree();picker();for(let i=0;i<4;i++)await tick();const insert=vi.spyOn(app.world,'insert');diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex d06e60db6..c64ec8134 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -30,6 +30,7 @@ export const NOTES_FLOOR = 'v0.65.0';export const NOTED = {'feat: add reusable TreeView and ColorPicker UI controls': { note: 'Reusable UI trees and color pickers.' },'fix(ui): align tree labels with hierarchy indentation': { note: 'Reusable UI trees and color pickers.' },+ 'fix(ui): keep tree selection when toggling disclosure': { note: 'Reusable UI trees and color pickers.' },'feat(editor): add TreeView and ColorPicker authoring': { note: 'Reusable UI trees and color pickers.' },'feat: add TabView and Tooltip UI controls': { note: 'UI tabs and tooltips.' },'fix(ui): use hover state and sustained captures for tooltips': { note: 'UI tabs and tooltips.' },