地图组件完善

hc_zhufu
zzq 2024-05-22 14:43:56 +08:00
parent 5927453973
commit a09621f9cb
1 changed files with 12 additions and 5 deletions

View File

@ -241,10 +241,13 @@
//
const handlerInitDrawTool = (feature, bool) => {
geojson.geojson = feature;
console.log('drawTool', drawTool);
console.log('feature', feature);
if (drawTool) {
drawTool.deleteAll();
drawTool.set(geojson.geojson);
if (feature.features) {
drawTool.set(geojson.geojson);
}
} else {
drawTool = new MapboxDraw({
modes: {
@ -267,7 +270,9 @@
if (bool) {
map.addControl(drawTool, 'top-right');
}
drawTool.set(geojson.geojson);
if (feature.features) {
drawTool.set(geojson.geojson);
}
}
//
drawing.value = true;
@ -386,8 +391,8 @@
modes: {
...MapboxDraw.modes,
draw_point: SnapPointMode,
draw_polygon: SnapPolygonMode,
draw_line_string: SnapLineMode,
// draw_polygon: SnapPolygonMode,
// draw_line_string: SnapLineMode,
direct_select: SnapDirectSelect,
},
styles: customDrawStyles,
@ -456,6 +461,8 @@
type: 'FeatureCollection',
features: [],
};
console.log('features', features);
console.log('bool', bool);
if (features == null) {
bool = true;
} else {