地图组件完善
parent
5927453973
commit
a09621f9cb
|
|
@ -241,10 +241,13 @@
|
||||||
// 初始化绘图空间
|
// 初始化绘图空间
|
||||||
const handlerInitDrawTool = (feature, bool) => {
|
const handlerInitDrawTool = (feature, bool) => {
|
||||||
geojson.geojson = feature;
|
geojson.geojson = feature;
|
||||||
|
console.log('drawTool', drawTool);
|
||||||
|
console.log('feature', feature);
|
||||||
if (drawTool) {
|
if (drawTool) {
|
||||||
drawTool.deleteAll();
|
drawTool.deleteAll();
|
||||||
|
if (feature.features) {
|
||||||
drawTool.set(geojson.geojson);
|
drawTool.set(geojson.geojson);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
drawTool = new MapboxDraw({
|
drawTool = new MapboxDraw({
|
||||||
modes: {
|
modes: {
|
||||||
|
|
@ -267,8 +270,10 @@
|
||||||
if (bool) {
|
if (bool) {
|
||||||
map.addControl(drawTool, 'top-right');
|
map.addControl(drawTool, 'top-right');
|
||||||
}
|
}
|
||||||
|
if (feature.features) {
|
||||||
drawTool.set(geojson.geojson);
|
drawTool.set(geojson.geojson);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 正在绘制
|
// 正在绘制
|
||||||
drawing.value = true;
|
drawing.value = true;
|
||||||
};
|
};
|
||||||
|
|
@ -386,8 +391,8 @@
|
||||||
modes: {
|
modes: {
|
||||||
...MapboxDraw.modes,
|
...MapboxDraw.modes,
|
||||||
draw_point: SnapPointMode,
|
draw_point: SnapPointMode,
|
||||||
draw_polygon: SnapPolygonMode,
|
// draw_polygon: SnapPolygonMode,
|
||||||
draw_line_string: SnapLineMode,
|
// draw_line_string: SnapLineMode,
|
||||||
direct_select: SnapDirectSelect,
|
direct_select: SnapDirectSelect,
|
||||||
},
|
},
|
||||||
styles: customDrawStyles,
|
styles: customDrawStyles,
|
||||||
|
|
@ -456,6 +461,8 @@
|
||||||
type: 'FeatureCollection',
|
type: 'FeatureCollection',
|
||||||
features: [],
|
features: [],
|
||||||
};
|
};
|
||||||
|
console.log('features', features);
|
||||||
|
console.log('bool', bool);
|
||||||
if (features == null) {
|
if (features == null) {
|
||||||
bool = true;
|
bool = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue