From 9df6b2453aee5da235bae7c3a29a5d464d9efe1c Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Thu, 30 May 2024 08:54:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=AD=BE=E5=90=8D?= =?UTF-8?q?=E6=9D=BF=E5=92=8C=E5=85=B3=E8=81=94=E9=80=89=E9=A1=B9=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=B8=8D=E5=85=BC=E5=AE=B9=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/writingboard/vueSignature.vue | 39 +++++++++++++++--------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/widget/writingboard/vueSignature.vue b/src/widget/writingboard/vueSignature.vue index 2f5752984..23312002d 100644 --- a/src/widget/writingboard/vueSignature.vue +++ b/src/widget/writingboard/vueSignature.vue @@ -102,20 +102,24 @@ const getSizeRatio = () => { return !props.fullScreen && props.backIsCenter } - const setCanvasImageBack = (status: any) => { - const canvas = canvasRef.value as HTMLCanvasElement - let pat = canvasTxt.value?.createPattern(canvasBackDom.value, (props.isRepeat || "no-repeat")); - canvasTxt.value?.rect(0,0,canvas.width ,canvas.height) - canvasTxt!.value!.fillStyle = (pat as any); - canvasTxt.value?.fill(); - if (status) { - autoDraw(null, null) + const setCanvasImageBack = (status: any,canvas:any) => { + //const canvas = canvasRef.value as HTMLCanvasElement + //console.log(canvas) + if(typeof(canvas)!="undefined"&&typeof(canvas.width)!="undefined"){ + let pat = canvasTxt.value?.createPattern(canvasBackDom.value, (props.isRepeat || "no-repeat")); + canvasTxt.value?.rect(0,0,canvas.width ,canvas.height) + canvasTxt!.value!.fillStyle = (pat as any); + canvasTxt.value?.fill(); + if (status) { + autoDraw(null, null) + } } + } - const setCanvasBack = (status: any) => { - const canvas = canvasRef.value as HTMLCanvasElement + const setCanvasBack = (status: any,canvas:any) => { + //const canvas = canvasRef.value as HTMLCanvasElement if (props.canvasBack && canvasBackDom.value && isImgaes(props.canvasBack)) { - setCanvasImageBack(status) + setCanvasImageBack(status,canvas)//liwenxuan } else { canvas.style.background = canvasBackground.value } @@ -145,12 +149,19 @@ canvasTxt.value?.scale(1 * sratio.value, 1 * sratio.value) sratio.value = realw / (domPatams.width ? domPatams.width : props.fullScreen ? screenPatams.width : props.width) canvasTxt.value?.scale(1 / sratio.value, 1 / sratio.value) + if (props.canvasBack) { let IntervaId = setInterval(() => { - if ((canvasBackDom.value && isLoad.value) || !isImgaes(props.canvasBack)) { - setCanvasBack(status) - clearInterval(IntervaId) + //console.log("111111111111111111111111111111111111111111111111111111") + //console.log(canvas) + if(typeof(canvas)!="undefined"){ + console.log(canvas) + if ((canvasBackDom.value && isLoad.value) || !isImgaes(props.canvasBack)) { + setCanvasBack(status,canvas)//liwenxuan + clearInterval(IntervaId) + } } + }, 100) } else { if (status) {