1
1
import React , { PropTypes } from 'react'
2
2
import { connect } from 'react-redux'
3
- import { FeatureGroup , MapLayer , Marker , Popup } from 'react-leaflet'
3
+ import { FeatureGroup , MapLayer , Popup , CircleMarker } from 'react-leaflet'
4
4
import { Button , ButtonGroup } from 'react-bootstrap'
5
5
import { divIcon } from 'leaflet'
6
6
@@ -28,7 +28,7 @@ class StopsOverlay extends MapLayer {
28
28
29
29
_refreshStops ( ) {
30
30
if ( this . context . map . getZoom ( ) < this . props . minZoom ) {
31
- this . props . clearStops ( )
31
+ this . forceUpdate ( )
32
32
return
33
33
}
34
34
@@ -39,7 +39,7 @@ class StopsOverlay extends MapLayer {
39
39
minLon : bounds . getWest ( ) ,
40
40
maxLon : bounds . getEast ( )
41
41
}
42
- this . props . refreshStops ( params )
42
+ setTimeout ( ( ) => { this . props . refreshStops ( params ) } , 300 )
43
43
}
44
44
45
45
createLeafletElement ( ) {
@@ -57,24 +57,17 @@ class StopsOverlay extends MapLayer {
57
57
return (
58
58
< FeatureGroup >
59
59
{ stops . map ( ( stop ) => {
60
- const icon = divIcon ( {
61
- iconSize : [ 20 , 20 ] ,
62
- iconAnchor : [ 12 , 15 ] ,
63
- popupAnchor : [ 1 , - 6 ] ,
64
- html : `<span class="fa-stack" style="opacity: 1.0" style={{ background: #00f }}>
65
- <i class="fa fa-circle fa-stack-1x" style="color: #ffffff"></i>
66
- <i class="fa fa-circle-o fa-stack-1x" style="color: #000000"></i>
67
- </span>` ,
68
- className : ''
69
- } )
70
-
71
60
const idArr = stop . id . split ( ':' )
72
61
73
62
return (
74
- < Marker
75
- icon = { icon }
63
+ < CircleMarker
76
64
key = { stop . id }
77
- position = { [ stop . lat , stop . lon ] }
65
+ center = { [ stop . lat , stop . lon ] }
66
+ radius = { 4 }
67
+ fillOpacity = { 1 }
68
+ fillColor = '#fff'
69
+ color = '#000'
70
+ weight = { 1.5 }
78
71
>
79
72
< Popup >
80
73
< div >
@@ -103,7 +96,7 @@ class StopsOverlay extends MapLayer {
103
96
</ div >
104
97
</ div >
105
98
</ Popup >
106
- </ Marker >
99
+ </ CircleMarker >
107
100
)
108
101
} ) }
109
102
</ FeatureGroup >
0 commit comments