22// TODO: Not sure if this is possible to actually type correctly with how the leaflet.locatecontrol library is written
33
44import { useEffect , useMemo , useState } from 'react'
5- import { LayerGroup , DomEvent , DomUtil , Control } from 'leaflet'
5+ import { LayerGroup , DomEvent , DomUtil } from 'leaflet'
66import { useTranslation } from 'react-i18next'
77import { useMap } from 'react-leaflet'
8- import 'leaflet.locatecontrol'
8+ import { LocateControl } from 'leaflet.locatecontrol'
99
1010import { useStorage } from '@store/useStorage'
1111import { useLocationError } from '@hooks/useLocationError'
1212
1313/**
1414 * Use location hook
15- * @returns {{ lc: Control.Locate & { _onClick: () => void }, requesting: boolean, color: import('@mui/material').ButtonProps['color'], locationError: { show: boolean, message: string }, hideLocationError: () => void } }
15+ * @returns {{ lc: import('leaflet.locatecontrol').LocateControl & { _onClick: () => void }, requesting: boolean, color: import('@mui/material').ButtonProps['color'], locationError: { show: boolean, message: string }, hideLocationError: () => void } }
1616 */
1717export function useLocation ( dependency = false ) {
1818 const map = useMap ( )
@@ -26,7 +26,7 @@ export function useLocation(dependency = false) {
2626 useLocationError ( )
2727
2828 const lc = useMemo ( ( ) => {
29- const LocateFab = Control . Locate . extend ( {
29+ const LocateFab = LocateControl . extend ( {
3030 _setClasses ( state ) {
3131 if ( state === 'requesting' ) setColor ( 'secondary' )
3232 else if ( state === 'active' ) setColor ( 'success' )
0 commit comments