无人机管理后台前端(已迁走)
张含笑
2025-10-30 c711e82c4b1685a4b00884d7aab70d9d3b0265ff
src/views/layerManagement/components/utils.js
@@ -101,9 +101,7 @@
   }
   // 绘制
   drawTheArea(data){
      this.whetherToDraw = data
      console.log('this',this.whetherToDraw);
      this.whetherToDraw = data
   }
   // 删除测区
   deleteTheArea(data) {
@@ -113,7 +111,7 @@
   // 开始绘制
   startDrawing() {
      if (!this.whetherToDraw) {
         console.log('当前不允许绘制,whetherToDraw 为 false');
         console.log('当前不允许绘制');
         return;
        }
       
@@ -241,8 +239,7 @@
      const pickedEntity = this.viewer.scene.pick(movement.position)?.id
      const isPoint = pickedEntity?.name === DrawPolygon.ENTITY_NAMES.POINT
console.log('pickedEntity',pickedEntity);
console.log('isPoint',isPoint);
      if (pickedEntity && isPoint) {
         this.isDragging = true
         this.draggedEntity = pickedEntity
@@ -293,9 +290,7 @@
      // 编辑模式下,拖拽点实时更新
      if (this.editingMode && this.draggedEntity?.customData) {
         this.draggedEntity.position = cartesian
         this.curPolygon.positions[this.draggedEntity?.customData.ind] = cartesian
         console.log('拖拽');
         this.curPolygon.positions[this.draggedEntity?.customData.ind] = cartesian
      }
      // 绘制模式下,实时更新最后一个点
@@ -330,7 +325,7 @@
      const isPolygonPoint = pickedAllEntity.find(i => i.id.name === DrawPolygon.ENTITY_NAMES.POINT)
      const isPolygon = pickedAllEntity.find(i => i.id.name === DrawPolygon.ENTITY_NAMES.POLYGON)
      if (this.drawingMode && !this.whetherToDraw) {
         console.log('当前不允许绘制,无法添加点或闭合多边形');
         console.log('当前不允许绘制');
         return; // 阻断后续绘制逻辑
        }
      // 如果不是绘制模式
@@ -570,7 +565,7 @@
        } else {
         // 新增:不允许绘制时,确保绘制模式为 false,避免误触发
         this.drawingMode = false;
         console.log('当前不允许绘制,初始化事件处理器但不启动绘制');
         console.log('当前不允许绘制');
        }
      
      let newPosition = positions.map(item => {