zhengnaiwen_citu hace 4 meses
padre
commit
b698cb1baf
Se han modificado 1 ficheros con 4 adiciones y 6 borrados
  1. 4 6
      src/views/components/MTry.vue

+ 4 - 6
src/views/components/MTry.vue

@@ -231,6 +231,7 @@ export default {
     },
     // 重置眼镜
     onReload () {
+      this.scale = 1
       this.$refs.cover.style.left = this.tryGlassesSize.center.x + 'px'
       this.$refs.cover.style.top = this.tryGlassesSize.center.y + 'px'
     },
@@ -270,18 +271,15 @@ export default {
     },
     onTouchStart (e) {
       this.canMove = true
-      const cover = this.$refs.cover
       const { left, top } = this.$refs.content.$el.getBoundingClientRect()
-      const { left: glassLeft, top: glassTop } = cover.getBoundingClientRect()
-      const clientHeight = cover.clientHeight
-      const clientWidth = cover.clientWidth
+      const { left: glassLeft, top: glassTop, height: glassHeight, width: glassWidth } = this.$refs.cover.getBoundingClientRect()
       const startX = this.isMobile ? e.touches[0].clientX : e.clientX
       const startY = this.isMobile ? e.touches[0].clientY : e.clientY
       this.moveObj = {
         startX,
         startY,
-        left: glassLeft - left + clientWidth / 2,
-        top: glassTop - top + clientHeight / 2
+        left: glassLeft - left + glassWidth / 2,
+        top: glassTop - top + glassHeight / 2
       }
     },
     onTouchEnd (e) {