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 a2283fefa5
commit 7157b29da0
2 changed files with 11 additions and 5 deletions

View File

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

View File

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