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(() => {
34 const popupH = popupBounding.height.value 34 const popupH = popupBounding.height.value
35 const vw = window.innerWidth 35 const vw = window.innerWidth
36 const vh = window.innerHeight 36 const vh = window.innerHeight
37 37 const isMobile = vw < 768
38 // Horizontal: prefer left of element, then right, then center in viewport 38
39 let left = bounding.left.value - popupW - 16 39 let top: number
40 if (left < margin) { 40 let left: number
41 const rightPos = bounding.right.value + 8 41
42 left = rightPos + popupW <= vw - margin 42 if (isMobile) {
43 ? rightPos 43 // Mobile: place above the title row, center horizontally, fall back to below
44 : (vw - popupW) / 2 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
45 } 56 }
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)
56 57
57 return { 58 return {
58 top: `${top}px`, 59 top: `${top}px`,