Browse Source

修改了签名板和关联选项设置不兼容的bug

lwx_v9
liwenxuan 2 years ago
parent
commit
9df6b2453a
  1. 39
      src/widget/writingboard/vueSignature.vue

39
src/widget/writingboard/vueSignature.vue

@ -102,20 +102,24 @@
const getSizeRatio = () => { const getSizeRatio = () => {
return !props.fullScreen && props.backIsCenter return !props.fullScreen && props.backIsCenter
} }
const setCanvasImageBack = (status: any) => { const setCanvasImageBack = (status: any,canvas:any) => {
const canvas = canvasRef.value as HTMLCanvasElement //const canvas = canvasRef.value as HTMLCanvasElement
let pat = canvasTxt.value?.createPattern(canvasBackDom.value, (props.isRepeat || "no-repeat")); //console.log(canvas)
canvasTxt.value?.rect(0,0,canvas.width ,canvas.height) if(typeof(canvas)!="undefined"&&typeof(canvas.width)!="undefined"){
canvasTxt!.value!.fillStyle = (pat as any); let pat = canvasTxt.value?.createPattern(canvasBackDom.value, (props.isRepeat || "no-repeat"));
canvasTxt.value?.fill(); canvasTxt.value?.rect(0,0,canvas.width ,canvas.height)
if (status) { canvasTxt!.value!.fillStyle = (pat as any);
autoDraw(null, null) canvasTxt.value?.fill();
if (status) {
autoDraw(null, null)
}
} }
} }
const setCanvasBack = (status: any) => { const setCanvasBack = (status: any,canvas:any) => {
const canvas = canvasRef.value as HTMLCanvasElement //const canvas = canvasRef.value as HTMLCanvasElement
if (props.canvasBack && canvasBackDom.value && isImgaes(props.canvasBack)) { if (props.canvasBack && canvasBackDom.value && isImgaes(props.canvasBack)) {
setCanvasImageBack(status) setCanvasImageBack(status,canvas)//liwenxuan
} else { } else {
canvas.style.background = canvasBackground.value canvas.style.background = canvasBackground.value
} }
@ -145,12 +149,19 @@
canvasTxt.value?.scale(1 * sratio.value, 1 * sratio.value) canvasTxt.value?.scale(1 * sratio.value, 1 * sratio.value)
sratio.value = realw / (domPatams.width ? domPatams.width : props.fullScreen ? screenPatams.width : props.width) sratio.value = realw / (domPatams.width ? domPatams.width : props.fullScreen ? screenPatams.width : props.width)
canvasTxt.value?.scale(1 / sratio.value, 1 / sratio.value) canvasTxt.value?.scale(1 / sratio.value, 1 / sratio.value)
if (props.canvasBack) { if (props.canvasBack) {
let IntervaId = setInterval(() => { let IntervaId = setInterval(() => {
if ((canvasBackDom.value && isLoad.value) || !isImgaes(props.canvasBack)) { //console.log("111111111111111111111111111111111111111111111111111111")
setCanvasBack(status) //console.log(canvas)
clearInterval(IntervaId) if(typeof(canvas)!="undefined"){
console.log(canvas)
if ((canvasBackDom.value && isLoad.value) || !isImgaes(props.canvasBack)) {
setCanvasBack(status,canvas)//liwenxuan
clearInterval(IntervaId)
}
} }
}, 100) }, 100)
} else { } else {
if (status) { if (status) {

Loading…
Cancel
Save