自适应水印缩放

This commit is contained in:
yanran200730
2022-06-16 09:00:13 +08:00
parent 1d6b6cb0a9
commit 76df280f16

View File

@@ -12,7 +12,7 @@
<div
class="watermark"
v-if="currIndex > -1 && currWatermarkConfig.length"
:style="{left: x + 'px', top: y + 'px' }"
:style="{left: x + 'px', top: y + 'px', transform: 'scale(' + watermarkScale + ')' }"
@touchstart="onTouchstart"
@touchmove="onTouchmove">
<component ref="WatermarkItem" :is="'Watermark' + (currIndex + 1)" :config="currWatermarkConfig"></component>
@@ -155,6 +155,7 @@
x: 32,
y: 24,
startX: 0,
watermarkScale: 1,
startY: 0,
canvasHeight: 0
}
@@ -224,6 +225,7 @@
const img = document.querySelector('.waterMarker-img')
this.canvasHeight = img.clientHeight
this.watermarkScale = img.clientWidth / uni.getSystemInfoSync().windowWidth
},
onTouchstart (e) {