From a09621f9cb3cd7bb8210543f3e388edb85ce68b8 Mon Sep 17 00:00:00 2001 From: zzq <15064940501@163.com> Date: Wed, 22 May 2024 14:43:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=BB=84=E4=BB=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MapboxMaps/MapComponent.vue | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/MapboxMaps/MapComponent.vue b/src/components/MapboxMaps/MapComponent.vue index a58694d4..850a6748 100644 --- a/src/components/MapboxMaps/MapComponent.vue +++ b/src/components/MapboxMaps/MapComponent.vue @@ -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 {