在传单地图上绘制多边形的自定义颜色
Custom color of draw polygon on leaflet map
我正在传单地图上绘制多边形
this.polygonDrawer = new L.Draw.Polygon(this.map);
如何自定义此多边形的颜色?就像我想要红色多边形应该绘制这样我可以在哪里提供这个颜色选项?
有一个 setOptions 函数。
this.polygonDrawer = new L.Draw.Polygon(this.map, {shapeOptions: {color: '#f00'}});
//or
this.polygonDrawer.setOptions({shapeOptions: {color: '#f00'}});
http://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html#l-draw-polyline-setoptions
PS: leaflet geoman 是一个非常好的和最新的 leaflet draw alternativ 库
我正在传单地图上绘制多边形
this.polygonDrawer = new L.Draw.Polygon(this.map);
如何自定义此多边形的颜色?就像我想要红色多边形应该绘制这样我可以在哪里提供这个颜色选项?
有一个 setOptions 函数。
this.polygonDrawer = new L.Draw.Polygon(this.map, {shapeOptions: {color: '#f00'}});
//or
this.polygonDrawer.setOptions({shapeOptions: {color: '#f00'}});
http://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html#l-draw-polyline-setoptions
PS: leaflet geoman 是一个非常好的和最新的 leaflet draw alternativ 库