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/DrawTool.js |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/utils/tools/DrawTool.js b/src/utils/tools/DrawTool.js
index 403906e..b06febd 100644
--- a/src/utils/tools/DrawTool.js
+++ b/src/utils/tools/DrawTool.js
@@ -19,7 +19,7 @@
 class DrawTool {
     constructor() {
         this._viewer = undefined
-        this._anchorLayer = undefined
+        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('tool-three-draw-anchor-layer')
         this._floatingAnchor = undefined
         this._options = {}
         this._plotEvent = new PlotEvent()
@@ -178,9 +178,6 @@
      * @returns {DrawTool}
      */
     activate (options = {}) {
-        this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('draw-anchor-layer')
-        this._viewer.dataSources.add(this._anchorLayer)
-
         this._viewer.tooltip.enable = true
         this._options = { ...DEF_OPTS, ...options }
         this._unbindEvent()
@@ -198,7 +195,6 @@
         this._viewer.tooltip.enable = false
         this._anchorLayer.entities.removeAll()
         this._floatingAnchor = undefined
-        this._viewer.dataSources.remove(this._anchorLayer)
         return this
     }
 
@@ -208,6 +204,7 @@
      */
     install (viewer) {
         this._viewer = viewer
+        this._viewer.dataSources.add(this._anchorLayer)
         Object.defineProperty(this._viewer, 'curDrawTool', {
             value: this,
             writable: true,

--
Gitblit v1.9.3