吉安感知网项目-前端
罗广辉
2026-04-08 42fcd9fbfb765ba41e1ab1a6b276671a2e6af9e7
packages/utils/map/DrawPolygon.js
@@ -61,6 +61,7 @@
      this.handleLeftUp = this.handleLeftUp.bind(this)
      this.handleMouseMove = this.handleMouseMove.bind(this)
      this.handleLeftClick = this.handleLeftClick.bind(this)
      this.handleDoubleClick = this.handleDoubleClick.bind(this)
      this.handleRightClick = this.handleRightClick.bind(this)
      this.delPolygon = this.delPolygon.bind(this)
@@ -548,6 +549,14 @@
      this.addPosition(cartesian)
   }
   // 鼠标双击(完成绘制)
   handleDoubleClick() {
      if (!this.drawingMode) return
      // 双击时第一次 LEFT_CLICK 已经添加了一个点,所以至少需要 4 个点(3个有效点 + 1个跟踪点)
      if (this.curPolygon.positions.length < 4) return
      this.finishDrawing()
   }
   // 鼠标右键点击(弹出菜单)
   handleRightClick(click) {
      const that = this
@@ -829,6 +838,7 @@
            [Cesium.ScreenSpaceEventType.LEFT_UP, this.handleLeftUp],
            [Cesium.ScreenSpaceEventType.MOUSE_MOVE, this.handleMouseMove],
            [Cesium.ScreenSpaceEventType.LEFT_CLICK, this.handleLeftClick],
            [Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, this.handleDoubleClick],
            [Cesium.ScreenSpaceEventType.RIGHT_CLICK, this.handleRightClick],
         ]
@@ -846,6 +856,7 @@
            Cesium.ScreenSpaceEventType.LEFT_UP,
            Cesium.ScreenSpaceEventType.MOUSE_MOVE,
            Cesium.ScreenSpaceEventType.LEFT_CLICK,
            Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
            Cesium.ScreenSpaceEventType.RIGHT_CLICK,
         ]