YaolongHan vor 5 Jahren
Ursprung
Commit
6ea647434c

+ 6 - 0
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -97,6 +97,9 @@ export default {
     eventBus.$on("suitableRatios", function() {
       that.view.fitSceneToView();
     });
+     eventBus.$on("changeRatios", function(val) {
+       that.changeRatios(val)
+    });
   },
   methods: {
     clickItem(item) {
@@ -153,6 +156,9 @@ export default {
     // 左键长按控制canvas的坐标
     leftClickMove(a, b) {
       //  console.log('move',a,b)
+    },
+    changeRatios(val){
+      console.log('val',val)
     }
   },
   watch: {

+ 26 - 13
src/views/ready/buildfloor/drawGraphy/operateGraphyItem.vue

@@ -9,45 +9,58 @@
     <div class="div-box">
       <i class="el-icon-download"></i>
     </div>
-    <div class="div-box"  @click="addRatio">
+    <div class="div-box" @click="removeRatio">
       <i class="el-icon-remove-outline"></i>
     </div>
     <div class="line">
-      <el-slider tooltip-class="tooltip-class" @change="adjustRatio"></el-slider>
+      <el-slider tooltip-class="tooltip-class" v-model="sliderValue" @change="adjustRatio"></el-slider>
     </div>
-    <div class="div-box" @click="removeRatio">
+    <div class="div-box" @click="addRatio">
       <i class="el-icon-circle-plus-outline"></i>
     </div>
   </div>
 </template>
 <script>
-import eventBus from "./bus.js"
+import eventBus from "./bus.js";
 export default {
   data() {
     return {
+      sliderValue: 10
     };
   },
   methods: {
     // 开启拖动
-    openDrag(){
+    openDrag() {
       // eventBus.$emit('openDrags')
     },
     //合适比例
-    suitableRatio(){
-      eventBus.$emit('suitableRatios')
+    suitableRatio() {
+      eventBus.$emit("suitableRatios");
     },
     // 滑块调整比例
-    adjustRatio(){
-       
+    adjustRatio(val) {
+      this.sliderValue = val;
+      eventBus.$emit("changeRatios", this.sliderValue);
     },
     //增加比例
-    addRatio(){
-
+    addRatio() {
+      if (this.sliderValue >= 90) {
+        this.sliderValue = 100;
+      } else {
+        this.sliderValue = this.sliderValue + 10;
+      }
+      eventBus.$emit("changeRatios", this.sliderValue);
     },
     //减少比例
-    removeRatio(){
+    removeRatio() {
+      if (this.sliderValue <= 10) {
+        this.sliderValue = 0;
+      } else {
+        this.sliderValue = this.sliderValue - 10;
+      }
+      eventBus.$emit("changeRatios", this.sliderValue);
     }
-  },
+  }
 };
 </script>
 <style lang="less">