From 35298bdcd712499f2066c0e80d37acc96c1d2a63 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 09 Feb 2022 15:52:24 +0800
Subject: [PATCH] 样式调整

---
 src/components/map/components/dimension.vue |   12 ++----
 public/img/icon/tool-area.png               |    0 
 src/styles/pcpage/tool/ranging.scss         |    3 +
 public/img/icon/tool-ranging.png            |    0 
 src/pcviews/tool/area.vue                   |   61 +++++++++++++++++++++++++++++-
 src/pcviews/tool/ranging.vue                |   15 +++++--
 src/pcviews/tool/sign.vue                   |    1 
 7 files changed, 76 insertions(+), 16 deletions(-)

diff --git a/public/img/icon/tool-area.png b/public/img/icon/tool-area.png
new file mode 100644
index 0000000..781f801
--- /dev/null
+++ b/public/img/icon/tool-area.png
Binary files differ
diff --git a/public/img/icon/dtcj.png b/public/img/icon/tool-ranging.png
similarity index 100%
rename from public/img/icon/dtcj.png
rename to public/img/icon/tool-ranging.png
Binary files differ
diff --git a/src/components/map/components/dimension.vue b/src/components/map/components/dimension.vue
index 2987c6e..fc87f7f 100644
--- a/src/components/map/components/dimension.vue
+++ b/src/components/map/components/dimension.vue
@@ -1,10 +1,6 @@
 <template>
     <div class="dimension-cut">
-        <el-radio-group
-            v-model="dimensionValue"
-            size="medium"
-            @change="dimensionChange"
-        >
+        <el-radio-group v-model="dimensionValue" size="medium" @change="dimensionChange">
             <el-radio-button label="三 维"></el-radio-button>
             <el-radio-button label="真三维"></el-radio-button>
         </el-radio-group>
@@ -592,8 +588,8 @@
                                 e.overlay.attr['楼栋号'] == '8栋'
                                     ? '9栋'
                                     : e.overlay.attr['楼栋号'] == '9栋'
-                                    ? '8栋'
-                                    : e.overlay.attr['楼栋号']
+                                        ? '8栋'
+                                        : e.overlay.attr['楼栋号']
                             this.$store.commit('CLEAR_ALL', null)
                             getDetail({ mechanismname: '香琴湾' + rid }).then(
                                 (res) => {
@@ -1233,7 +1229,7 @@
 }
 </script>
 
-<style lang='scss' scope>
+<style lang="scss" scoped>
 .dimension-cut {
     position: fixed;
     top: 100px;
diff --git a/src/pcviews/tool/area.vue b/src/pcviews/tool/area.vue
index 82a21ec..42f1067 100644
--- a/src/pcviews/tool/area.vue
+++ b/src/pcviews/tool/area.vue
@@ -7,10 +7,10 @@
  */
 
 <template>
-    <div class="tool-ranging">
+    <div class="tool-area" ref="toolAreaBox">
         <div class="header" @mousedown="move" :class="{'move': moveFlag}">
             <div class="title">
-                <img class="icon deblurring" src="/img/icon/dtcj.png" alt />
+                <img class="icon deblurring" src="/img/icon/tool-area.png" alt />
                 <span>地图测面</span>
             </div>
             <img class="close" src="/img/navicon/close.png" alt @click="closeModel" />
@@ -28,6 +28,11 @@
 import { mapGetters } from 'vuex'
 
 export default {
+    data () {
+        return {
+            moveFlag: false
+        }
+    },
     computed: {
         ...mapGetters([
             'viewer'
@@ -36,6 +41,53 @@
     created () {
     },
     methods: {
+        move (e) {
+            const that = this
+            const odiv = this.$refs.toolAreaBox // 获取目标元素
+            // 算出鼠标相对元素的位置
+            const disX = e.clientX - odiv.offsetLeft
+            const disY = e.clientY - odiv.offsetTop
+
+            const disH = odiv.offsetHeight
+            const disW = odiv.offsetWidth
+
+            document.onmousemove = (e) => {
+                that.moveFlag = true
+                // 鼠标按下并移动的事件
+                // 用鼠标的位置减去鼠标相对元素的位置,得到元素的位置
+                let left = e.clientX - disX
+                let top = e.clientY - disY
+
+                // 绑定元素位置到positionX和positionY上面
+
+                if (left >= window.innerWidth - disW) {
+                    left = window.innerWidth - disW
+                }
+
+                if (left <= 0) {
+                    left = 0
+                }
+
+                if (top >= window.innerHeight - disH) {
+                    top = window.innerHeight - disH
+                }
+
+                if (top <= 60) {
+                    top = 60
+                }
+
+                // 移动当前元素
+                odiv.style.left = (left) + 'px'
+                odiv.style.top = (top) + 'px'
+                odiv.style.bottom = 'auto'
+            }
+            document.onmouseup = (e) => {
+                that.moveFlag = false
+                document.onmousemove = null
+                document.onmouseup = null
+            }
+        },
+
         calcDistance () {
             this.viewer.measure.areaSurface()
         },
@@ -54,5 +106,8 @@
 }
 </script>
 
-<style>
+<style lang="scss" scoped>
+.move {
+    cursor: move;
+}
 </style>
diff --git a/src/pcviews/tool/ranging.vue b/src/pcviews/tool/ranging.vue
index 7c6f6de..075fb6c 100644
--- a/src/pcviews/tool/ranging.vue
+++ b/src/pcviews/tool/ranging.vue
@@ -7,10 +7,10 @@
  */
 
 <template>
-    <div class="tool-ranging">
+    <div class="tool-ranging" ref="toolRangingBox">
         <div class="header" @mousedown="move" :class="{ move: moveFlag }">
             <div class="title">
-                <img class="icon deblurring" src="/img/icon/dtcj.png" alt />
+                <img class="icon deblurring" src="/img/icon/tool-ranging.png" alt />
                 <span>地图测距</span>
             </div>
             <img class="close" src="/img/navicon/close.png" alt @click="closeModel" />
@@ -27,6 +27,11 @@
 import { mapGetters } from 'vuex'
 
 export default {
+    data () {
+        return {
+            moveFlag: false
+        }
+    },
     computed: {
         ...mapGetters(['viewer'])
     },
@@ -34,7 +39,7 @@
     methods: {
         move (e) {
             const that = this
-            const odiv = this.$refs.publicOrgNavBar // 获取目标元素
+            const odiv = this.$refs.toolRangingBox // 获取目标元素
             // 算出鼠标相对元素的位置
             const disX = e.clientX - odiv.offsetLeft
             const disY = e.clientY - odiv.offsetTop
@@ -96,5 +101,7 @@
 }
 </script>
 
-<style>
+<style lang="sass" scoped>
+.move
+    cursor: move
 </style>
diff --git a/src/pcviews/tool/sign.vue b/src/pcviews/tool/sign.vue
index 20ae00b..b361e48 100644
--- a/src/pcviews/tool/sign.vue
+++ b/src/pcviews/tool/sign.vue
@@ -15,6 +15,7 @@
     created () {
         var that = this
         that.DC = global.DC
+        that.viewer.tooltip.enable = true
         that.viewer.on(that.DC.MouseEventType.MOUSE_MOVE, (e) => {
             that.viewer.tooltip.showAt(e.windowPosition, '我是鼠标提示')
         })
diff --git a/src/styles/pcpage/tool/ranging.scss b/src/styles/pcpage/tool/ranging.scss
index ddfb0a8..ba50817 100644
--- a/src/styles/pcpage/tool/ranging.scss
+++ b/src/styles/pcpage/tool/ranging.scss
@@ -1,4 +1,5 @@
-.tool-ranging {
+.tool-ranging,
+.tool-area {
     position: fixed;
     top: 100px;
     left: 140px;

--
Gitblit v1.9.3