@@ -2,34 +2,33 @@ import React from 'react';
22import { divIcon , LatLngExpression } from 'leaflet' ;
33import { Marker } from 'react-leaflet' ;
44import { renderToStaticMarkup } from 'react-dom/server' ;
5- import { getColors , getNumSeverity } from '../../utils/mapUtils' ;
6- import { Accident , ClusterRow } from '../../types' ;
7- // import { getColorByVehicle } from '../../../services/mapUtils';
8- import { IconBike , IconBus , IconCar , IconEmpty , IconMotorcycle , IconQuestion , IconScooter , IconTruck , IconWalk } from '../map/markers' ;
5+ import { ClusterRow } from '../../types' ;
6+ import { IconEmpty , IconCircle } from '../map/markers' ;
97import ModelMarkerPopUp from './ModelMarkerPopUp' ;
10- //import AccidentPopUp from './AccidentPopUp';
118
129// const iconSize = {
1310// iconSize: [25, 41], iconAnchor: [12, 41], popupAnchor: [1, -34], shadowSize: [41, 41],
1411// };
1512
16- const customMarketIcon = ( iconMarkup :any , isSmall : boolean = false ) => {
17- const size = isSmall ? 9 : 22 ;
13+ const customMarketIcon = ( iconMarkup :any , size : number = 40 ) => {
14+ const half = size / 2 ;
1815 const res = divIcon ( {
1916 html : iconMarkup ,
2017 className : 'ship-div-icon' ,
21- iconAnchor : [ 0 , size ] ,
22- popupAnchor : [ 2 , - ( size - 2 ) ] ,
18+ iconAnchor : [ - 2 , half ] ,
19+ popupAnchor : [ 0 , - half ]
2320 } ) ;
2421 return res ;
2522} ;
2623
27- const getEmptyIcon = ( color : string , isAccuratePos : boolean ) => {
28- const pin = < IconEmpty fill = { color } isAccuratePos = { isAccuratePos } /> ;
24+ const getEmptyIcon = ( color : string , isHeat : boolean ) => {
25+ const opacity = isHeat ? 0.35 : 0.8 ;
26+ const size = isHeat ? 40 : 30 ;
27+ const pin = < IconCircle fill = { color } size = { size } opacity = { opacity } isAccuratePos = { false } /> ;
2928 const iconMarkup = renderToStaticMarkup (
3029 pin ,
3130 ) ;
32- const res = customMarketIcon ( iconMarkup ) ;
31+ const res = customMarketIcon ( iconMarkup , size ) ;
3332 return res ;
3433} ;
3534
@@ -39,15 +38,13 @@ interface IProps {
3938 language : string ,
4039 color : string ,
4140 markerIconsType : string ,
41+ isHeat : boolean
4242}
4343const ModelMarker : React . FC < IProps > = ( ( {
44- data, position, language, color, markerIconsType ,
44+ data, position, language, color, isHeat ,
4545} ) => {
46- //const lPoint = new L.LatLng(data.latitude, data.longitude);
47- //const color = (data.roadType=="junction")? '#D87F1D':'#A0202F'; //getColors(colorBy, data);
4846 const severity = 1 ; // getNumSeverity(data.injury_severity_hebrew);
49- //const isSmall = severity === 3;
50- const icon = getEmptyIcon ( color , true ) ;
47+ const icon = getEmptyIcon ( color , isHeat ) ;
5148 return (
5249 < Marker position = { position } icon = { icon }
5350 // @ts -ignore to allow custom props in Marker options
0 commit comments