✨ (stacked notes) breadcrumb on the right too.
This commit is contained in:
@@ -2,12 +2,14 @@ import { computed, onMounted, ref } from '@vue/runtime-core'
|
|||||||
|
|
||||||
import { NOTE_WIDTH } from '@/constants/note-width'
|
import { NOTE_WIDTH } from '@/constants/note-width'
|
||||||
import { useOverlay } from '@/hooks/useOverlay.hook'
|
import { useOverlay } from '@/hooks/useOverlay.hook'
|
||||||
|
import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
|
||||||
|
|
||||||
const BOOKMARK_WIDTH = 2
|
const BOOKMARK_WIDTH = 2
|
||||||
|
|
||||||
export const useNoteOverlay = (className: string, index: number) => {
|
export const useNoteOverlay = (className: string, index: number) => {
|
||||||
const { x, y, isMobile } = useOverlay()
|
const { x, y, isMobile } = useOverlay()
|
||||||
const noteHeight = ref(0)
|
const noteHeight = ref(0)
|
||||||
|
|
||||||
const displayNoteOverlay = computed(() => {
|
const displayNoteOverlay = computed(() => {
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
return y.value > index * noteHeight.value
|
return y.value > index * noteHeight.value
|
||||||
@@ -17,6 +19,7 @@ export const useNoteOverlay = (className: string, index: number) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const { stackedNotes } = useQueryStackedNotes()
|
||||||
const noteElement = document.querySelector(
|
const noteElement = document.querySelector(
|
||||||
`.${className}`
|
`.${className}`
|
||||||
) as HTMLElement | null
|
) as HTMLElement | null
|
||||||
@@ -30,6 +33,10 @@ export const useNoteOverlay = (className: string, index: number) => {
|
|||||||
noteElement.style.top = `0`
|
noteElement.style.top = `0`
|
||||||
} else {
|
} else {
|
||||||
noteElement.style.left = `${(index + 1) * BOOKMARK_WIDTH}rem`
|
noteElement.style.left = `${(index + 1) * BOOKMARK_WIDTH}rem`
|
||||||
|
noteElement.style.right = `calc(-${NOTE_WIDTH}px + ${(stackedNotes.value
|
||||||
|
.length -
|
||||||
|
index) *
|
||||||
|
BOOKMARK_WIDTH}rem)`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user