Revize c0b66eaf
Přidáno uživatelem Václav Honzík před asi 2 roky(ů)
frontend/src/features/TrackingTool/Map/MapMarker.tsx | ||
---|---|---|
1 |
import { LatLngTuple, Marker as MarkerPOJO } from 'leaflet' |
|
1 |
import L, { LatLngTuple, Marker as MarkerPOJO } from 'leaflet'
|
|
2 | 2 |
import { FunctionComponent, ReactNode, useMemo, useRef, useState } from 'react' |
3 | 3 |
import { Marker } from 'react-leaflet' |
4 |
import { |
|
5 |
getMapPointIcon, |
|
6 |
MapPoint, |
|
7 |
} from '../trackingToolUtils' |
|
4 | 8 |
|
5 | 9 |
export interface MapMarkerProps { |
6 | 10 |
position: LatLngTuple |
7 | 11 |
children?: ReactNode |
12 |
mapPoint: MapPoint |
|
8 | 13 |
color?: 'external' | 'disabled' | 'localCatalog' |
9 | 14 |
updatePositionCallbackFn: (position: LatLngTuple) => void // Callback function to notify MapPath to rerender the path |
10 | 15 |
} |
... | ... | |
14 | 19 |
position, |
15 | 20 |
children, |
16 | 21 |
updatePositionCallbackFn, |
22 |
mapPoint, |
|
17 | 23 |
}) => { |
18 | 24 |
const [currentPosition, setCurrentPosition] = useState(position) |
19 | 25 |
const markerRef = useRef<MarkerPOJO | null>(null) |
... | ... | |
37 | 43 |
<Marker |
38 | 44 |
draggable={true} |
39 | 45 |
position={currentPosition} |
46 |
icon={getMapPointIcon(mapPoint)} |
|
40 | 47 |
eventHandlers={eventHandlers} |
41 | 48 |
ref={markerRef} |
42 | 49 |
> |
Také k dispozici: Unified diff
map icon colors start
re #9741