fix: improve draggable button constraints to avoid action button overlap
Query actual action button position to calculate safe dragging bounds. Increased fallback estimate from 48px to 80px for better clearance. Button now properly stays below download/action button.
This commit is contained in:
parent
fc1d7fcbd6
commit
00b0fb297b
|
|
@ -36,8 +36,8 @@ export function MobileSettingsButton({ config, onClick }: MobileSettingsButtonPr
|
||||||
} else {
|
} else {
|
||||||
// Default position: below nav and action button
|
// Default position: below nav and action button
|
||||||
const navHeight = 60 // Approximate --app-nav-height
|
const navHeight = 60 // Approximate --app-nav-height
|
||||||
const actionButtonHeight = 48 // Approximate height of download/action button
|
const actionButtonArea = 80 // Generous estimate including padding
|
||||||
setPosition({ x: MARGIN, y: navHeight + actionButtonHeight + MARGIN })
|
setPosition({ x: MARGIN, y: navHeight + actionButtonArea })
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|
@ -52,10 +52,22 @@ export function MobileSettingsButton({ config, onClick }: MobileSettingsButtonPr
|
||||||
|
|
||||||
const rect = buttonRef.current.getBoundingClientRect()
|
const rect = buttonRef.current.getBoundingClientRect()
|
||||||
|
|
||||||
// Calculate bounds
|
// Calculate bounds - need to stay below the download/action button
|
||||||
|
// Try to find the actual action button element to get its real height
|
||||||
|
const actionButton = document.querySelector('[data-action="generate-worksheet"]')
|
||||||
|
let actionButtonBottom = 0
|
||||||
|
|
||||||
|
if (actionButton) {
|
||||||
|
const actionRect = actionButton.getBoundingClientRect()
|
||||||
|
actionButtonBottom = actionRect.bottom + MARGIN
|
||||||
|
} else {
|
||||||
|
// Fallback: estimate based on nav height + action button area
|
||||||
const navHeight = 60 // Approximate --app-nav-height
|
const navHeight = 60 // Approximate --app-nav-height
|
||||||
const actionButtonHeight = 48 // Approximate height of download/action button
|
const actionButtonArea = 80 // More generous estimate including padding
|
||||||
const minY = navHeight + actionButtonHeight + MARGIN // Don't go above action button
|
actionButtonBottom = navHeight + actionButtonArea
|
||||||
|
}
|
||||||
|
|
||||||
|
const minY = actionButtonBottom
|
||||||
const maxX = window.innerWidth - rect.width - MARGIN
|
const maxX = window.innerWidth - rect.width - MARGIN
|
||||||
const maxY = window.innerHeight - rect.height - MARGIN
|
const maxY = window.innerHeight - rect.height - MARGIN
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue