From de589bf91a39be0f0fc0d3d58b1ede04a6937a4f Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 18 Apr 2023 11:44:09 +0800
Subject: [PATCH] bug调整

---
 src/utils/tools/EditTool.js |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/utils/tools/EditTool.js b/src/utils/tools/EditTool.js
index efc8595..63d3371 100644
--- a/src/utils/tools/EditTool.js
+++ b/src/utils/tools/EditTool.js
@@ -22,7 +22,7 @@
 class EditTool {
     constructor() {
         this._viewer = undefined
-        this._anchorLayer = undefined
+        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('tool-three-edit-anchor-layer')
         this._options = {}
         this._plotEvent = new PlotEvent()
         this._tooltipMess = undefined
@@ -245,8 +245,7 @@
      * @returns {EditTool}
      */
     activate (options = {}) {
-        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('edit-anchor-layer')
-        this._viewer.dataSources.add(this._anchorLayer)
+        this._anchorLayer.entities.removeAll()
 
         this._viewer.tooltip.enable = true
         this._options = { ...DEF_OPTS, ...options }
@@ -265,7 +264,6 @@
         this._viewer.tooltip.enable = false
         this._anchorLayer.entities.removeAll()
         this._anchors = []
-        this._viewer.dataSources.remove(this._anchorLayer)
         return this
     }
 
@@ -275,6 +273,7 @@
      */
     install (viewer) {
         this._viewer = viewer
+        this._viewer.dataSources.add(this._anchorLayer)
         Object.defineProperty(this._viewer, 'curEditTool', {
             value: this,
             writable: true,

--
Gitblit v1.9.3