From ac59d030fef13920f65b65e9fe0b09d086547be7 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 12 Apr 2023 17:13:37 +0800
Subject: [PATCH] 电子沙盘三维BUG

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

diff --git a/src/utils/tools/EditTool.js b/src/utils/tools/EditTool.js
index 80e90ff..b463c5b 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 = new global.DC.Namespace.Cesium.CustomDataSource('edit-anchor-layer')
+        this._anchorLayer = undefined
         this._options = {}
         this._plotEvent = new PlotEvent()
         this._tooltipMess = undefined
@@ -245,6 +245,9 @@
      * @returns {EditTool}
      */
     activate (options = {}) {
+        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('edit-anchor-layer')
+        this._viewer.dataSources.add(this._anchorLayer)
+
         this._viewer.tooltip.enable = true
         this._options = { ...DEF_OPTS, ...options }
         this._unbindEvent()
@@ -262,6 +265,7 @@
         this._viewer.tooltip.enable = false
         this._anchorLayer.entities.removeAll()
         this._anchors = []
+        this._viewer.dataSources.remove(this._anchorLayer)
         return this
     }
 
@@ -271,7 +275,6 @@
      */
     install (viewer) {
         this._viewer = viewer
-        this._viewer.dataSources.add(this._anchorLayer)
         Object.defineProperty(this._viewer, 'curEditTool', {
             value: this,
             writable: true,

--
Gitblit v1.9.3