浏览代码

mapgl: draw markers as circles

Bernadette Elena Hammerle 4 年之前
父节点
当前提交
ea9e2568a3
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      src/maps/MapGL.js

+ 9 - 5
src/maps/MapGL.js

@@ -108,12 +108,13 @@ export default class MapGL extends React.Component{
               source="routeSource"
               id="route"
               type="line"
-              paint={{"line-color": "#888", "line-width": 2}}
+              paint={{"line-color": "#888", "line-width": 3}}
               layout= {{"line-join": "round", "line-cap": "round"}}
             />
           </Source>
 
-          {this.state.path.map((pos, idx) =>
+          {this.state.path.map((pos, idx) => {
+            return(
             <Marker
               longitude={pos[0]}
               latitude={pos[1]}
@@ -124,11 +125,14 @@ export default class MapGL extends React.Component{
               key={idx}
               onDragEnd={(e) => this.updateMarker(idx, e)}
             >
-              <svg height={20} viewBox="0 0 24 24" style={{fill: "#343a40", stroke: "none"}}>
-                <path d={markerIcon} />
+              <svg height={20} viewBox="0 0 24 24" style={{fill: "#343a40", stroke: "none", position: "absolute", top: "3px"}}>
+                {(idx===0 || idx===this.state.path.length-1 ?
+                  (<path d={markerIcon} /> )
+                  : (<circle cx="10" cy="19" r="5"/>)
+                )}
               </svg>
             </Marker>
-          )}
+          )})}
 
             <div className="controllers">
               <GeolocateControl />