Stop preview jumping when scrolling to components, and improve scrolling behaviour
This commit is contained in:
parent
d0414812cf
commit
a83e987dcd
|
@ -475,7 +475,7 @@
|
|||
node.style.scrollMargin = "100px"
|
||||
node.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start",
|
||||
block: "nearest",
|
||||
inline: "start",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -73,18 +73,20 @@
|
|||
)
|
||||
$: autoCloseSidePanel = !$builderStore.inBuilder && $sidePanelStore.open
|
||||
|
||||
// Scroll navigation into view if selected
|
||||
$: {
|
||||
if (
|
||||
// Scroll navigation into view if selected.
|
||||
// Memoize into a primitive to avoid spamming this whenever builder store
|
||||
// changes.
|
||||
$: selected =
|
||||
$builderStore.inBuilder &&
|
||||
$builderStore.selectedComponentId === "navigation"
|
||||
) {
|
||||
$: {
|
||||
if (selected) {
|
||||
const node = document.getElementsByClassName("nav-wrapper")?.[0]
|
||||
if (node) {
|
||||
node.style.scrollMargin = "100px"
|
||||
node.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "start",
|
||||
block: "nearest",
|
||||
inline: "start",
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue