吉安感知网项目-前端
罗广辉
2026-04-09 b9bb41cc8eebf3b09460daf96c7261c83005f69a
feat: 新建面优化
1 files modified
10 ■■■■■ changed files
packages/utils/map/DrawPolygon.js 10 ●●●●● patch | view | raw | blame | history
packages/utils/map/DrawPolygon.js
@@ -70,6 +70,8 @@
        this.listeners = []
        // 绘制提示 tooltip
        this.drawingTooltip = null
        // 防止双击时第二次点击添加重复的点
        this._lastClickTime = 0
    }
    // 实体命名常量
@@ -130,6 +132,7 @@
    // 开始绘制
    startDrawing() {
        this.drawingMode = true
        this._lastClickTime = 0
        this.curPolygon = new Cesium.PolygonHierarchy()
        // 如果还没有 DataSource,就新建一个
@@ -528,6 +531,13 @@
            return
        }
        // 防止双击时第二次点击添加重复的点(双击触发顺序:click → click → dblclick)
        const now = Date.now()
        if (this._lastClickTime && (now - this._lastClickTime) < 300) {
            return
        }
        this._lastClickTime = now
        // 添加新的点
        const cartesian = this.viewer.scene.pickPosition(click.position)
        if (!cartesian) return