Fix filter tags overlapping zoom control by adjusting positioning

Co-authored-by: antontranelis <31516529+antontranelis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-09-07 10:06:04 +00:00
parent f60b484cc4
commit f27044ea41
3 changed files with 16 additions and 3 deletions

View File

@ -7,11 +7,13 @@ export const Control = ({
children, children,
zIndex, zIndex,
absolute, absolute,
showZoomControl = false,
}: { }: {
position: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' position: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'
children: React.ReactNode children: React.ReactNode
zIndex: string zIndex: string
absolute: boolean absolute: boolean
showZoomControl?: boolean
}) => { }) => {
const controlContainerRef = createRef<HTMLDivElement>() const controlContainerRef = createRef<HTMLDivElement>()
@ -22,11 +24,19 @@ export const Control = ({
} }
}, [controlContainerRef]) }, [controlContainerRef])
// Calculate left position when zoom control is present
const getLeftPosition = () => {
if ((position === 'topLeft' || position === 'bottomLeft') && showZoomControl) {
return 'tw:left-20' // Approximately 5rem (80px) to account for zoom control width
}
return position === 'topLeft' || position === 'bottomLeft' ? 'tw:left-4' : ''
}
return ( return (
<div <div
ref={controlContainerRef} ref={controlContainerRef}
style={{ zIndex }} style={{ zIndex }}
className={`${absolute && 'tw:absolute'} tw:z-999 tw:flex-col ${position === 'topLeft' && 'tw:top-4 tw:left-4'} ${position === 'bottomLeft' && 'tw:bottom-4 tw:left-4'} ${position === 'topRight' && 'tw:bottom-4 tw:right-4'} ${position === 'bottomRight' && 'tw:bottom-4 tw:right-4'}`} className={`${absolute && 'tw:absolute'} tw:z-999 tw:flex-col ${position === 'topLeft' && `tw:top-4 ${getLeftPosition()}`} ${position === 'bottomLeft' && `tw:bottom-4 ${getLeftPosition()}`} ${position === 'topRight' && 'tw:bottom-4 tw:right-4'} ${position === 'bottomRight' && 'tw:bottom-4 tw:right-4'}`}
> >
{children} {children}
</div> </div>

View File

@ -106,6 +106,7 @@ function UtopiaMap({
showFilterControl={showFilterControl} showFilterControl={showFilterControl}
showGratitudeControl={showGratitudeControl} showGratitudeControl={showGratitudeControl}
showLayerControl={showLayerControl} showLayerControl={showLayerControl}
showZoomControl={showZoomControl}
donationWidget={donationWidget} donationWidget={donationWidget}
showThemeControl={showThemeControl} showThemeControl={showThemeControl}
defaultTheme={defaultTheme} defaultTheme={defaultTheme}

View File

@ -51,6 +51,7 @@ export function UtopiaMapInner({
showFilterControl = false, showFilterControl = false,
showGratitudeControl = false, showGratitudeControl = false,
showLayerControl = true, showLayerControl = true,
showZoomControl = false,
showThemeControl = false, showThemeControl = false,
defaultTheme = '', defaultTheme = '',
donationWidget, donationWidget,
@ -63,6 +64,7 @@ export function UtopiaMapInner({
showFilterControl?: boolean showFilterControl?: boolean
showLayerControl?: boolean showLayerControl?: boolean
showGratitudeControl?: boolean showGratitudeControl?: boolean
showZoomControl?: boolean
donationWidget?: boolean donationWidget?: boolean
showThemeControl?: boolean showThemeControl?: boolean
defaultTheme?: string defaultTheme?: string
@ -271,11 +273,11 @@ export function UtopiaMapInner({
return ( return (
<div className={`tw:h-full ${selectNewItemPosition != null ? 'crosshair-cursor-enabled' : ''}`}> <div className={`tw:h-full ${selectNewItemPosition != null ? 'crosshair-cursor-enabled' : ''}`}>
<Outlet /> <Outlet />
<Control position='topLeft' zIndex='1000' absolute> <Control position='topLeft' zIndex='1000' absolute showZoomControl={showZoomControl}>
<SearchControl /> <SearchControl />
<TagsControl /> <TagsControl />
</Control> </Control>
<Control position='bottomLeft' zIndex='999' absolute> <Control position='bottomLeft' zIndex='999' absolute showZoomControl={showZoomControl}>
{showFilterControl && <FilterControl />} {showFilterControl && <FilterControl />}
{showLayerControl && <LayerControl expandLayerControl={expandLayerControl ?? false} />} {showLayerControl && <LayerControl expandLayerControl={expandLayerControl ?? false} />}
{showGratitudeControl && <GratitudeControl />} {showGratitudeControl && <GratitudeControl />}