Browse Source

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

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

23
src/widget/writingboard/vueSignature.vue

@ -102,8 +102,10 @@
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
//console.log(canvas)
if(typeof(canvas)!="undefined"&&typeof(canvas.width)!="undefined"){
let pat = canvasTxt.value?.createPattern(canvasBackDom.value, (props.isRepeat || "no-repeat")); let pat = canvasTxt.value?.createPattern(canvasBackDom.value, (props.isRepeat || "no-repeat"));
canvasTxt.value?.rect(0,0,canvas.width ,canvas.height) canvasTxt.value?.rect(0,0,canvas.width ,canvas.height)
canvasTxt!.value!.fillStyle = (pat as any); canvasTxt!.value!.fillStyle = (pat as any);
@ -112,10 +114,12 @@
autoDraw(null, null) 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)) { 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(() => {
//console.log("111111111111111111111111111111111111111111111111111111")
//console.log(canvas)
if(typeof(canvas)!="undefined"){
console.log(canvas)
if ((canvasBackDom.value && isLoad.value) || !isImgaes(props.canvasBack)) { if ((canvasBackDom.value && isLoad.value) || !isImgaes(props.canvasBack)) {
setCanvasBack(status) setCanvasBack(status,canvas)//liwenxuan
clearInterval(IntervaId) clearInterval(IntervaId)
} }
}
}, 100) }, 100)
} else { } else {
if (status) { if (status) {

Loading…
Cancel
Save