From 08dcd230c69aae42284a68177b4cb0b4c105c573 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 22 Sep 2021 18:44:30 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=E4=BC=98=E5=8C=96=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=A2=84=E5=AE=9A=E4=BD=8D=E9=98=B4=E5=BD=B1?= =?UTF-8?q?=E5=8C=BA=EF=BC=8C=E9=98=B2=E6=AD=A2=E9=98=B4=E5=BD=B1=E5=8C=BA?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E6=98=AF=E8=B6=85=E5=87=BA=E8=BE=B9=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/shadow.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/components/DeDrag/shadow.vue b/frontend/src/components/DeDrag/shadow.vue index 53794f8950..1277038296 100644 --- a/frontend/src/components/DeDrag/shadow.vue +++ b/frontend/src/components/DeDrag/shadow.vue @@ -37,6 +37,13 @@ export default { top = Math.round(top / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight height = Math.round(height / this.curCanvasScale.matrixStyleHeight) * this.curCanvasScale.matrixStyleHeight } + + // 防止阴影区超出边界 + const xGap = left + width - this.canvasWidth + // console.log('canvasWidth:' + this.canvasWidth + ';xGap:' + xGap) + if (xGap > 0) { + left = left - xGap + } const style = { transform: `translate(${left}px, ${top}px) rotate(0deg)`, width: width + 'px', @@ -55,6 +62,10 @@ export default { dragComponentInfo() { return this.$store.state.dragComponentInfo }, + canvasWidth() { + const scaleWidth = this.curCanvasScale.scaleWidth / 100 + return this.canvasStyleData.width * scaleWidth + }, ...mapState([ 'curComponent', 'editor',