fix close button in SelectPosition

This commit is contained in:
Anton Tranelis 2025-10-12 09:29:03 +02:00
parent e7b04757f0
commit 8ce41ec098

View File

@ -1,3 +1,6 @@
import { DomEvent } from 'leaflet'
import { useEffect, useRef } from 'react'
import type { Item } from '#types/Item'
import type { LayerProps } from '#types/LayerProps'
@ -8,11 +11,25 @@ export const SelectPosition = ({
setSelectNewItemPosition: React.Dispatch<React.SetStateAction<Item | LayerProps | null>>
selectNewItemPosition?: Item | LayerProps | null
}) => {
const containerRef = useRef<HTMLDivElement>(null)
useEffect(() => {
if (containerRef.current) {
DomEvent.disableClickPropagation(containerRef.current)
DomEvent.disableScrollPropagation(containerRef.current)
}
}, [])
return (
<div className='tw:animate-pulseGrow tw:button tw:z-1000 tw:absolute tw:right-5 tw:top-4 tw:drop-shadow-md'>
<div
ref={containerRef}
className='tw:animate-pulseGrow tw:button tw:z-1000 tw:absolute tw:right-5 tw:top-4 tw:drop-shadow-md'
>
<label
className='tw:btn tw:btn-sm tw:rounded-2xl tw:btn-circle tw:btn-ghost tw:hover:bg-transparent tw:absolute tw:right-0 tw:top-0 tw:text-gray-600'
onClick={() => {
onClick={(e) => {
e.stopPropagation()
e.preventDefault()
setSelectNewItemPosition(null)
}}
>