🐛 (focus) wait 100 for first stacked note
This commit is contained in:
@@ -22,13 +22,15 @@ export const useFocus = () => {
|
||||
nextTick(() => {
|
||||
const index = stackedNotes.value.findIndex((noteSHA) => noteSHA === sha)
|
||||
|
||||
const hasOneStackedNote = stackedNotes.value.length === 1
|
||||
|
||||
if (isMobile.value) {
|
||||
const element = document.querySelector(`.note-${sha}`) as HTMLElement
|
||||
const top = (index + 1) * (element?.clientHeight ?? height.value)
|
||||
scrollToNote(top)
|
||||
scrollToNote(top, hasOneStackedNote)
|
||||
} else {
|
||||
const left = (index + 1) * NOTE_WIDTH
|
||||
scrollToNote(left)
|
||||
scrollToNote(left, hasOneStackedNote)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ export const useOverlay = (listen = true) => {
|
||||
)
|
||||
}
|
||||
|
||||
const scrollToNote = (to: number) => {
|
||||
const scrollToNote = (to: number, wait = false) => {
|
||||
const go = () => {
|
||||
if (isMobile.value) {
|
||||
body.scroll({
|
||||
top: to
|
||||
@@ -37,6 +38,15 @@ export const useOverlay = (listen = true) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (wait) {
|
||||
setTimeout(() => {
|
||||
go()
|
||||
}, 100)
|
||||
} else {
|
||||
go()
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
x,
|
||||
y,
|
||||
|
||||
Reference in New Issue
Block a user