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 = () => {
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) {

Loading…
Cancel
Save