Commit a365cb4f by 李伟康

commit 提交

1 parent 46100d3a
......@@ -76,9 +76,9 @@
<zoom-pan
:class="['canvas-box',{fill:custom}]"
:disabled="drawStatus"
:scale-value="defaultScaleValue"
scale-max="5"
scale-min="1"
:restore="watchStatus"
:scale-max="5"
:scale-min="1"
@scale="scale"
>
<template slot="content">
......@@ -862,7 +862,6 @@ export default {
},
//清空画板
clearBoard () {
this.defaultScaleValue = 1
this.historyList = [];
this.drawContext?.draw()
},
......
......@@ -23,17 +23,14 @@ import utils from "@/utils/utils.js";
export default {
props: {
disabled: Boolean,
scaleValue: {
type: Number,
default: 1
},
restore: Number,
scaleMax: {
type: Number,
default: 10
},
scaleMin: {
type: Number,
default: 0.5
default: 1
},
},
data () {
......@@ -56,14 +53,15 @@ export default {
},
watch: {
watchScaleValue () {
this.lastScale = this.scaleValue
this.scale = this.scaleValue
this.transformStyle = `translate(0px, 0px) scale(${this.scaleValue})`
this.lastScale = 1
this.scale = 1
this.transformStyle = `scale(1) translate(0px, 0px)`
console.log(this.transformStyle)
}
},
computed: {
watchScaleValue () {
return this.scaleValue
return this.restore
}
},
methods: {
......@@ -79,6 +77,7 @@ export default {
[this.startX, this.startY] = [e.touches[0].pageX, e.touches[0].pageY];
this.moveX = 0
this.moveY = 0
this.transformOriginStyle = `${this.startX}px ${this.startY}px`;
}
},
handleTouchMove: utils.throttle(function (e) {
......@@ -123,17 +122,6 @@ export default {
return Math.sqrt(dx * dx + dy * dy);
},
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})`;
......
......@@ -107,7 +107,7 @@ export default {
return this.type != 'preview' && this.drawStatus
},
watchPayInfo () {
return this.$store.state.user.paymentType.length
return this.$store.state.user.paymentType.length ? true : false
},
title () {
let { id } = this,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!