Support scrolling screens or folders into view when clicking

This commit is contained in:
Andrew Kingston 2022-03-21 14:46:59 +00:00
parent e68f1e33b9
commit ed7a80ca6f
2 changed files with 11 additions and 5 deletions

View File

@ -20,8 +20,13 @@
let contentRef let contentRef
$: selected && contentRef && scrollToView() $: selected && contentRef && scrollToView()
function onIconClick(event) { const onClick = () => {
event.stopPropagation() scrollToView()
dispatch("click")
}
const onIconClick = e => {
e.stopPropagation()
dispatch("iconClick") dispatch("iconClick")
} }
@ -44,7 +49,7 @@
on:dragstart on:dragstart
on:dragover on:dragover
on:drop on:drop
on:click on:click={onClick}
ondragover="return false" ondragover="return false"
ondragenter="return false" ondragenter="return false"
> >

View File

@ -30,7 +30,9 @@
export let indent export let indent
export let border export let border
let folder
let routeManuallyOpened = false let routeManuallyOpened = false
$: selectedScreen = $currentAsset $: selectedScreen = $currentAsset
$: allScreens = getAllScreens(route) $: allScreens = getAllScreens(route)
$: filteredScreens = getFilteredScreens(allScreens, $screenSearchString) $: filteredScreens = getFilteredScreens(allScreens, $screenSearchString)
@ -85,8 +87,7 @@
<NavItem <NavItem
icon="WebPage" icon="WebPage"
indentLevel={indent || 1} indentLevel={indent || 1}
selected={$store.selectedScreenId === screen.id && selected={$store.selectedScreenId === screen.id}
$store.currentView === "detail"}
opened={$store.selectedScreenId === screen.id} opened={$store.selectedScreenId === screen.id}
text={ROUTE_NAME_MAP[screen.route]?.[screen.role] || screen.route} text={ROUTE_NAME_MAP[screen.route]?.[screen.role] || screen.route}
withArrow={route.subpaths} withArrow={route.subpaths}