Auto-expand layers tree to reveal selected node
This commit is contained in:
parent
c36f3c4667
commit
299d9b73b8
|
|
@ -29,8 +29,12 @@
|
||||||
|
|
||||||
### UI
|
### UI
|
||||||
|
|
||||||
- Resizable pages/layers split in left panel using reka-ui Splitter
|
- Resizable pages/layers split in left panel with reka-ui Splitter
|
||||||
|
- Layers tree auto-expands and scrolls to reveal selected node
|
||||||
- Loading overlay on canvas while opening .fig files
|
- Loading overlay on canvas while opening .fig files
|
||||||
|
- Hide internal-only pages (e.g. "Internal Only Canvas" in design systems)
|
||||||
|
- Render page dividers — pages named with only dashes/asterisks/spaces show as horizontal lines
|
||||||
|
- Only show component labels for COMPONENT and COMPONENT_SET, not instances
|
||||||
- Replace all native `<select>` dropdowns with reka-ui `AppSelect` component
|
- Replace all native `<select>` dropdowns with reka-ui `AppSelect` component
|
||||||
- Smoother trackpad pinch-to-zoom with `Math.exp` curve and deltaMode normalization
|
- Smoother trackpad pinch-to-zoom with `Math.exp` curve and deltaMode normalization
|
||||||
- Fix font picker dropdown truncating long font names
|
- Fix font picker dropdown truncating long font names
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch, nextTick } from 'vue'
|
||||||
import { useEventListener } from '@vueuse/core'
|
import { useEventListener } from '@vueuse/core'
|
||||||
import { TreeRoot, TreeItem, ContextMenuRoot, ContextMenuTrigger, ContextMenuPortal } from 'reka-ui'
|
import { TreeRoot, TreeItem, ContextMenuRoot, ContextMenuTrigger, ContextMenuPortal } from 'reka-ui'
|
||||||
|
|
||||||
|
|
@ -74,6 +74,29 @@ watch([() => store.state.sceneVersion, () => store.state.currentPageId], () => {
|
||||||
|
|
||||||
const expanded = ref<string[]>([])
|
const expanded = ref<string[]>([])
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => store.state.selectedIds,
|
||||||
|
(ids) => {
|
||||||
|
const toExpand = new Set(expanded.value)
|
||||||
|
for (const id of ids) {
|
||||||
|
let node = store.graph.getNode(id)
|
||||||
|
while (node?.parentId && node.parentId !== store.state.currentPageId) {
|
||||||
|
toExpand.add(node.parentId)
|
||||||
|
node = store.graph.getNode(node.parentId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (toExpand.size > expanded.value.length) {
|
||||||
|
expanded.value = [...toExpand]
|
||||||
|
}
|
||||||
|
nextTick(() => {
|
||||||
|
const first = [...ids][0]
|
||||||
|
if (!first) return
|
||||||
|
const el = listRef.value?.querySelector<HTMLElement>(`[data-node-id="${first}"]`)
|
||||||
|
el?.scrollIntoView({ block: 'nearest' })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
function onSelect(ev: CustomEvent) {
|
function onSelect(ev: CustomEvent) {
|
||||||
ev.preventDefault()
|
ev.preventDefault()
|
||||||
const node = ev.detail.value as LayerNode
|
const node = ev.detail.value as LayerNode
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue