File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -50,23 +50,24 @@ class RouteViewerOverlay extends MapLayer {
50
50
if ( ! routeData || ! routeData . patterns ) return < FeatureGroup />
51
51
52
52
const routeColor = routeData . color ? `#${ routeData . color } ` : '#00bfff'
53
- return (
54
- < FeatureGroup >
55
- { Object . values ( routeData . patterns ) . map ( pattern => {
56
- if ( ! pattern . geometry ) return null
57
- const pts = polyline . decode ( pattern . geometry . points )
58
- return (
59
- < Polyline
60
- positions = { pts }
61
- weight = { 4 }
62
- color = { routeColor }
63
- opacity = { 1 }
64
- key = { pattern . id }
65
- />
66
- )
67
- } ) }
68
- </ FeatureGroup >
69
- )
53
+ const segments = [ ]
54
+ Object . values ( routeData . patterns ) . forEach ( pattern => {
55
+ if ( ! pattern . geometry ) return
56
+ const pts = polyline . decode ( pattern . geometry . points )
57
+ segments . push (
58
+ < Polyline
59
+ positions = { pts }
60
+ weight = { 4 }
61
+ color = { routeColor }
62
+ opacity = { 1 }
63
+ key = { pattern . id }
64
+ />
65
+ )
66
+ } )
67
+
68
+ return segments . length > 0
69
+ ? < FeatureGroup > < div > { segments } </ div > </ FeatureGroup >
70
+ : < FeatureGroup />
70
71
}
71
72
}
72
73
You can’t perform that action at this time.
0 commit comments