下面是我创建多边形的代码,我想让这个可编辑,所以,我已经通过了“editable:true”选项来映射。 但是形状仍然不可编辑。
this.map = L.mapbox.map('map', null, {editable: true}).setView(DEFAULT_LAT_LONG, DEFAULT_ZOOM);
this.drawnItems = L.featureGroup().addTo(this.map);
this.drawControl = new L.Control.Draw({
position: 'topright',
draw: {
polygon: {
shapeOptions: CONSTANTS.POLYGON_OPTION,
allowIntersection: false,
drawError: {
color: 'orange',
timeout: 1000
},
showArea: true,
metric: false,
repeatMode: false
}
},
edit: {
featureGroup: this.drawnItems
}
});
this.drawHandler = new L.Draw.Polygon(this.map,this.drawControl.options.draw.polygon);
this.drawHandler.enable();
this.map.on('draw:created', function(e) {
this.drawnItems.addLayer(e.layer);
this.calculateArea(e.layer);
this.mapState = MAP_STATE.NONE;
}.bind(this));
答案 0 :(得分:0)
您需要在选项中设置editable: true
。
请参阅此链接:https://developers.google.com/maps/documentation/javascript/examples/user-editable-shapes