From d8d0f5fb17025c8ea92ef9f03ad5cc57d18b3b16 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Thu, 24 Jun 2021 09:08:54 +0800
Subject: [PATCH] xj

---
 widgets/digTheEarth/Widget.js |   66 +++++++--------------------------
 1 files changed, 14 insertions(+), 52 deletions(-)

diff --git a/widgets/digTheEarth/Widget.js b/widgets/digTheEarth/Widget.js
index 2501555..ad787cd 100644
--- a/widgets/digTheEarth/Widget.js
+++ b/widgets/digTheEarth/Widget.js
@@ -27,7 +27,10 @@
                     that.closesDigTheEarth();
                 })
 
-                // that.beginDigTheEarth();
+                $("#beginigTheEarth").click(()=>{
+                    that.beginDigTheEarth(); 
+
+                })
             },
             beginDigTheEarth: function () {
                 var that = this
@@ -49,50 +52,8 @@
                 //         roll: 6.2831853016686185
                 //     }
                 // });
-                function createTooltip(frameDiv) {//抄录createTooltip函数
-
-                    var tooltip = function (frameDiv) {
-
-                        var div = document.createElement('DIV');
-                        div.className = "twipsy right";
-
-                        var arrow = document.createElement('DIV');
-                        arrow.className = "twipsy-arrow";
-                        div.appendChild(arrow);
-
-                        var title = document.createElement('DIV');
-                        title.className = "twipsy-inner";
-                        div.appendChild(title);
-
-                        this._div = div;
-                        this._title = title;
-                        this.message = '';
-
-                        // add to frame div and display coordinates
-                        frameDiv.appendChild(div);
-                        var that = this;
-                        div.onmousemove = function (evt) {
-                            that.showAt({ x: evt.clientX, y: evt.clientY }, that.message);
-                        };
-                    };
-
-                    tooltip.prototype.setVisible = function (visible) {
-                        this._div.style.display = visible ? 'block' : 'none';
-                    };
-
-                    tooltip.prototype.showAt = function (position, message) {
-                        if (position && message) {
-                            this.setVisible(true);
-                            this._title.innerHTML = message;
-                            this._div.style.left = position.x + 10 + "px";
-                            this._div.style.top = (position.y - this._div.clientHeight / 2) + "px";
-                            this.message = message;
-                        }
-                    };
-
-                    return new tooltip(frameDiv);
-                }
-                var tooltip = createTooltip(viewer._element);
+              
+                var tooltip = window.MYcreateTooltip(viewer._element);
                 //绘制多边形
                 var handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
                 handlerPolygon.activeEvt.addEventListener(function (isActive) {
@@ -156,15 +117,16 @@
                 });
                 handlerPolygon.activate();
                 document.getElementById("cleardigTheEarth").onclick = function () {
-                    viewer.scene.globe.removeAllExcavationRegion();
-                    if (handlerPolygon.polygon) {
-                        handlerPolygon.polygon.show = false;
-                    }
-                    if (handlerPolygon.polyline) {
-                        handlerPolygon.polyline.show = false;
-                    }
+                    // viewer.scene.globe.removeAllExcavationRegion();
+                    // if (handlerPolygon.polygon) {
+                    //     handlerPolygon.polygon.show = false;
+                    // }
+                    // if (handlerPolygon.polyline) {
+                    //     handlerPolygon.polyline.show = false;
+                    // }
                     // handlerPolygon.polygon.show = false;
                     // handlerPolygon.polyline.show = false;
+                    that.closesDigTheEarth();
                 };
 
                 if (!scene.pickPositionSupported) {

--
Gitblit v1.9.3