Commit 704e197b83

704e197b83a8eae05c83f0e7b0ab24d620e41689

parent: 19ced346f4

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-06-15 05:27 UTC

Update MenuHelp.vue

Layout: unified · split

docs/.vitepress/theme/components/settings/MenuHelp.vue +19 −18
@@ -34,25 +34,26 @@ const helpPopupStyle = computed(() => {
3434 const popupH = popupBounding.height.value
3535 const vw = window.innerWidth
3636 const vh = window.innerHeight
37
38 // Horizontal: prefer left of element, then right, then center in viewport
39 let left = bounding.left.value - popupW - 16
40 if (left < margin) {
41 const rightPos = bounding.right.value + 8
42 left = rightPos + popupW <= vw - margin
43 ? rightPos
44 : (vw - popupW) / 2
37 const isMobile = vw < 768
38
39 let top: number
40 let left: number
41
42 if (isMobile) {
43 // Mobile: place above the title row, center horizontally, fall back to below
44 const aboveTop = bounding.top.value - popupH - 8
45 const belowTop = bounding.bottom.value + 8
46 top = aboveTop >= margin
47 ? aboveTop
48 : belowTop + popupH <= vh - margin
49 ? belowTop
50 : Math.max(margin, vh - popupH - margin)
51 left = Math.max(margin, Math.min((vw - popupW) / 2, vw - popupW - margin))
52 } else {
53 // Desktop: place to the left of the menu title, aligned vertically
54 left = bounding.left.value - popupW - 16
55 top = bounding.top.value
4556 }
46 left = Math.max(margin, Math.min(left, vw - popupW - margin))
47
48 // Vertical: prefer above the title row, fall back to below
49 const aboveTop = bounding.top.value - popupH - 8
50 const belowTop = bounding.bottom.value + 8
51 const top = aboveTop >= margin
52 ? aboveTop
53 : belowTop + popupH <= vh - margin
54 ? belowTop
55 : Math.max(margin, vh - popupH - margin)
5657
5758 return {
5859 top: `${top}px`,