|
@@ -14,12 +14,8 @@
|
|
class="cover noMove"
|
|
class="cover noMove"
|
|
:class="{ 'cursor-pointer': canMove}"
|
|
:class="{ 'cursor-pointer': canMove}"
|
|
ref="cover"
|
|
ref="cover"
|
|
- @touchstart="onTouchStart"
|
|
|
|
- @touchend="onTouchEnd"
|
|
|
|
- @mousedown="onTouchStart"
|
|
|
|
- @mouseup="onTouchEnd"
|
|
|
|
- :width="tryGlassesSize.width"
|
|
|
|
- :style="`--deg: ${tryGlassesSize.deg}deg`"
|
|
|
|
|
|
+ :width="tryGlassesSize.width * scale"
|
|
|
|
+ :style="`--deg: ${tryGlassesSize.deg}deg;`"
|
|
>
|
|
>
|
|
<img class="noMove" :src="src" alt="" :width="size.width" :height="size.height">
|
|
<img class="noMove" :src="src" alt="" :width="size.width" :height="size.height">
|
|
</v-card>
|
|
</v-card>
|
|
@@ -99,6 +95,7 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
isMobile: isMobile(),
|
|
isMobile: isMobile(),
|
|
|
|
+ scale: 1,
|
|
clear: false,
|
|
clear: false,
|
|
active: 0,
|
|
active: 0,
|
|
canMove: false,
|
|
canMove: false,
|
|
@@ -126,10 +123,10 @@ export default {
|
|
inject: ['size'],
|
|
inject: ['size'],
|
|
computed: {
|
|
computed: {
|
|
faceType () {
|
|
faceType () {
|
|
- return programType.find(e => e.value === this.chooseItem.facetype).face
|
|
|
|
|
|
+ return programType.find(e => e.value === this.chooseItem.facetype)?.face ?? ''
|
|
},
|
|
},
|
|
chooseItem () {
|
|
chooseItem () {
|
|
- return this.item.items[this.active]
|
|
|
|
|
|
+ return this.item.items[this.active] ?? {}
|
|
},
|
|
},
|
|
tryGlassesSize () {
|
|
tryGlassesSize () {
|
|
const x1 = this.item.facial_points.cheek_left_3.x
|
|
const x1 = this.item.facial_points.cheek_left_3.x
|
|
@@ -148,6 +145,14 @@ export default {
|
|
icon: this.clear ? 'mdi-eye-outline' : 'mdi-eye-off-outline',
|
|
icon: this.clear ? 'mdi-eye-outline' : 'mdi-eye-off-outline',
|
|
handle: this.onClear
|
|
handle: this.onClear
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ icon: 'mdi-plus',
|
|
|
|
+ handle: this.onPlus
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ icon: 'mdi-minus',
|
|
|
|
+ handle: this.onMinus
|
|
|
|
+ },
|
|
{
|
|
{
|
|
icon: 'mdi-swap-horizontal',
|
|
icon: 'mdi-swap-horizontal',
|
|
handle: this.onChange
|
|
handle: this.onChange
|
|
@@ -176,30 +181,42 @@ export default {
|
|
if (this.isMobile) {
|
|
if (this.isMobile) {
|
|
this.$refs.content.$el.addEventListener('touchmove', this.onTouchMove)
|
|
this.$refs.content.$el.addEventListener('touchmove', this.onTouchMove)
|
|
this.$refs.content.$el.addEventListener('touchend', this.onTouchLeave)
|
|
this.$refs.content.$el.addEventListener('touchend', this.onTouchLeave)
|
|
- // this.$refs.cover.addEventListener('touchstart', this.onTouchStart)
|
|
|
|
- // this.$refs.cover.addEventListener('touchend', this.onTouchEnd)
|
|
|
|
|
|
+ this.$refs.cover.addEventListener('touchstart', this.onTouchStart)
|
|
|
|
+ this.$refs.cover.addEventListener('touchend', this.onTouchEnd)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.$refs.content.$el.addEventListener('mousemove', this.onTouchMove)
|
|
this.$refs.content.$el.addEventListener('mousemove', this.onTouchMove)
|
|
this.$refs.content.$el.addEventListener('mouseleave', this.onTouchLeave)
|
|
this.$refs.content.$el.addEventListener('mouseleave', this.onTouchLeave)
|
|
- // this.$refs.cover.addEventListener('mousedown', this.onTouchStart)
|
|
|
|
- // this.$refs.cover.addEventListener('mouseup', this.onTouchEnd)
|
|
|
|
|
|
+ this.$refs.cover.addEventListener('mousedown', this.onTouchStart)
|
|
|
|
+ this.$refs.cover.addEventListener('mouseup', this.onTouchEnd)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
beforeDestroy () {
|
|
beforeDestroy () {
|
|
if (this.isMobile) {
|
|
if (this.isMobile) {
|
|
this.$refs.content.$el.removeEventListener('touchmove', this.onTouchMove)
|
|
this.$refs.content.$el.removeEventListener('touchmove', this.onTouchMove)
|
|
this.$refs.content.$el.removeEventListener('touchend', this.onTouchLeave)
|
|
this.$refs.content.$el.removeEventListener('touchend', this.onTouchLeave)
|
|
- // this.$refs.cover.removeEventListener('touchstart', this.onTouchStart)
|
|
|
|
- // this.$refs.cover.removeEventListener('touchend', this.onTouchEnd)
|
|
|
|
|
|
+ this.$refs.cover.removeEventListener('touchstart', this.onTouchStart)
|
|
|
|
+ this.$refs.cover.removeEventListener('touchend', this.onTouchEnd)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.$refs.content.$el.removeEventListener('mousemove', this.onTouchMove)
|
|
this.$refs.content.$el.removeEventListener('mousemove', this.onTouchMove)
|
|
this.$refs.content.$el.removeEventListener('mouseleave', this.onTouchLeave)
|
|
this.$refs.content.$el.removeEventListener('mouseleave', this.onTouchLeave)
|
|
- // this.$refs.cover.removeEventListener('mousedown', this.onTouchStart)
|
|
|
|
- // this.$refs.cover.removeEventListener('mouseup', this.onTouchEnd)
|
|
|
|
|
|
+ this.$refs.cover.addEventListener('touchstart', this.onTouchMove)
|
|
|
|
+ this.$refs.cover.addEventListener('touchend', this.onTouchLeave)
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onPlus () {
|
|
|
|
+ if (this.scale > 1.6) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.scale += 0.2
|
|
|
|
+ },
|
|
|
|
+ onMinus () {
|
|
|
|
+ if (this.scale < 0.4) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.scale -= 0.2
|
|
|
|
+ },
|
|
// 清屏
|
|
// 清屏
|
|
onClear () {
|
|
onClear () {
|
|
this.clear = !this.clear
|
|
this.clear = !this.clear
|
|
@@ -258,9 +275,11 @@ export default {
|
|
const { left: glassLeft, top: glassTop } = cover.getBoundingClientRect()
|
|
const { left: glassLeft, top: glassTop } = cover.getBoundingClientRect()
|
|
const clientHeight = cover.clientHeight
|
|
const clientHeight = cover.clientHeight
|
|
const clientWidth = cover.clientWidth
|
|
const clientWidth = cover.clientWidth
|
|
|
|
+ const startX = this.isMobile ? e.touches[0].clientX : e.clientX
|
|
|
|
+ const startY = this.isMobile ? e.touches[0].clientY : e.clientY
|
|
this.moveObj = {
|
|
this.moveObj = {
|
|
- startX: this.isMobile ? e.touches[0].clientX : e.clientX,
|
|
|
|
- startY: this.isMobile ? e.touches[0].clientY : e.clientY,
|
|
|
|
|
|
+ startX,
|
|
|
|
+ startY,
|
|
left: glassLeft - left + clientWidth / 2,
|
|
left: glassLeft - left + clientWidth / 2,
|
|
top: glassTop - top + clientHeight / 2
|
|
top: glassTop - top + clientHeight / 2
|
|
}
|
|
}
|