Skip to content

Commit 77deab9

Browse files
author
David Emory
committed
fix(overlay): Fix conflict between stops-layer rendering and transitive overlay
1 parent b660141 commit 77deab9

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

lib/components/map/stops-overlay.js

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PropTypes } from 'react'
22
import { connect } from 'react-redux'
3-
import { FeatureGroup, MapLayer, Marker, Popup } from 'react-leaflet'
3+
import { FeatureGroup, MapLayer, Popup, CircleMarker } from 'react-leaflet'
44
import { Button, ButtonGroup } from 'react-bootstrap'
55
import { divIcon } from 'leaflet'
66

@@ -28,7 +28,7 @@ class StopsOverlay extends MapLayer {
2828

2929
_refreshStops () {
3030
if (this.context.map.getZoom() < this.props.minZoom) {
31-
this.props.clearStops()
31+
this.forceUpdate()
3232
return
3333
}
3434

@@ -39,7 +39,7 @@ class StopsOverlay extends MapLayer {
3939
minLon: bounds.getWest(),
4040
maxLon: bounds.getEast()
4141
}
42-
this.props.refreshStops(params)
42+
setTimeout(() => { this.props.refreshStops(params) }, 300)
4343
}
4444

4545
createLeafletElement () {
@@ -57,24 +57,17 @@ class StopsOverlay extends MapLayer {
5757
return (
5858
<FeatureGroup>
5959
{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-
7160
const idArr = stop.id.split(':')
7261

7362
return (
74-
<Marker
75-
icon={icon}
63+
<CircleMarker
7664
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}
7871
>
7972
<Popup>
8073
<div>
@@ -103,7 +96,7 @@ class StopsOverlay extends MapLayer {
10396
</div>
10497
</div>
10598
</Popup>
106-
</Marker>
99+
</CircleMarker>
107100
)
108101
})}
109102
</FeatureGroup>

0 commit comments

Comments
 (0)