Commit a365cb4f by 李伟康

commit 提交

1 parent 46100d3a
...@@ -76,9 +76,9 @@ ...@@ -76,9 +76,9 @@
<zoom-pan <zoom-pan
:class="['canvas-box',{fill:custom}]" :class="['canvas-box',{fill:custom}]"
:disabled="drawStatus" :disabled="drawStatus"
:scale-value="defaultScaleValue" :restore="watchStatus"
scale-max="5" :scale-max="5"
scale-min="1" :scale-min="1"
@scale="scale" @scale="scale"
> >
<template slot="content"> <template slot="content">
...@@ -862,7 +862,6 @@ export default { ...@@ -862,7 +862,6 @@ export default {
}, },
//清空画板 //清空画板
clearBoard () { clearBoard () {
this.defaultScaleValue = 1
this.historyList = []; this.historyList = [];
this.drawContext?.draw() this.drawContext?.draw()
}, },
......
...@@ -23,17 +23,14 @@ import utils from "@/utils/utils.js"; ...@@ -23,17 +23,14 @@ import utils from "@/utils/utils.js";
export default { export default {
props: { props: {
disabled: Boolean, disabled: Boolean,
scaleValue: { restore: Number,
type: Number,
default: 1
},
scaleMax: { scaleMax: {
type: Number, type: Number,
default: 10 default: 10
}, },
scaleMin: { scaleMin: {
type: Number, type: Number,
default: 0.5 default: 1
}, },
}, },
data () { data () {
...@@ -56,14 +53,15 @@ export default { ...@@ -56,14 +53,15 @@ export default {
}, },
watch: { watch: {
watchScaleValue () { watchScaleValue () {
this.lastScale = this.scaleValue this.lastScale = 1
this.scale = this.scaleValue this.scale = 1
this.transformStyle = `translate(0px, 0px) scale(${this.scaleValue})` this.transformStyle = `scale(1) translate(0px, 0px)`
console.log(this.transformStyle)
} }
}, },
computed: { computed: {
watchScaleValue () { watchScaleValue () {
return this.scaleValue return this.restore
} }
}, },
methods: { methods: {
...@@ -79,6 +77,7 @@ export default { ...@@ -79,6 +77,7 @@ export default {
[this.startX, this.startY] = [e.touches[0].pageX, e.touches[0].pageY]; [this.startX, this.startY] = [e.touches[0].pageX, e.touches[0].pageY];
this.moveX = 0 this.moveX = 0
this.moveY = 0 this.moveY = 0
this.transformOriginStyle = `${this.startX}px ${this.startY}px`;
} }
}, },
handleTouchMove: utils.throttle(function (e) { handleTouchMove: utils.throttle(function (e) {
...@@ -123,17 +122,6 @@ export default { ...@@ -123,17 +122,6 @@ export default {
return Math.sqrt(dx * dx + dy * dy); return Math.sqrt(dx * dx + dy * dy);
}, },
async updatePosition () { async updatePosition () {
const containerRect = await this.getQueryInfo('.container')
const contentRect = await this.getQueryInfo('.content')
const contentWidth = contentRect.width * this.scale; // 缩放后的内容宽度
const contentHeight = contentRect.height * this.scale; // 缩放后的内容高度
// 计算内容可以移动的最大范围,确保内容不会超出容器
let maxX = (containerRect.width - contentWidth) / 2;
let maxY = (containerRect.height - contentHeight) / 2;
// 限制移动范围,确保内容不移出容器
this.moveX = Math.min(Math.max(this.moveX, -maxX), maxX);
this.moveY = Math.min(Math.max(this.moveY, -maxY), maxY);
// 更新位置并确保内容不超出容器 // 更新位置并确保内容不超出容器
// 注意:此处需根据实际容器大小和内容尺寸进行调整 // 注意:此处需根据实际容器大小和内容尺寸进行调整
this.transformStyle = `translate(${this.moveX}px, ${this.moveY}px) scale(${this.scale})`; this.transformStyle = `translate(${this.moveX}px, ${this.moveY}px) scale(${this.scale})`;
......
...@@ -107,7 +107,7 @@ export default { ...@@ -107,7 +107,7 @@ export default {
return this.type != 'preview' && this.drawStatus return this.type != 'preview' && this.drawStatus
}, },
watchPayInfo () { watchPayInfo () {
return this.$store.state.user.paymentType.length return this.$store.state.user.paymentType.length ? true : false
}, },
title () { title () {
let { id } = this, let { id } = this,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!