| | |
| | | this.curLine = []; |
| | | this.chirography = []; |
| | | this.canvasContext.clearRect(0, 0, this.cavWidth, this.cavHeight); |
| | | this.canvasContext.setFillStyle('#ffffff'); |
| | | this.canvasContext.fillRect(0, 0, this.cavWidth, this.cavHeight); |
| | | this.canvasContext.draw(); |
| | | }, |
| | | handleClose() { |
| | |
| | | } |
| | | ctx.draw(true); |
| | | }, |
| | | _brushingGround(callback) { |
| | | Taro.canvasToTempFilePath({ |
| | | canvasId: this.cavId, |
| | | x: 0, |
| | | y: 0, |
| | | width: Math.ceil(this.cavWidth), |
| | | height: Math.ceil(this.cavHeight), |
| | | destWidth: Math.ceil(this.cavWidth), |
| | | destHeight: Math.ceil(this.cavHeight), |
| | | quality: 1, |
| | | fileType: 'png', |
| | | success: res => { |
| | | const ctx = this.canvasContext; |
| | | ctx.setFillStyle('#ffffff'); |
| | | ctx.fillRect(0, 0, this.cavWidth, this.cavHeight); |
| | | ctx.drawImage(res.tempFilePath, 0, 0); |
| | | ctx.draw(false, () => { |
| | | callback(); |
| | | }); |
| | | }, |
| | | }); |
| | | }, |
| | | handleSaveDraw() { |
| | | if (this.firstTouch) { |
| | | Tools.toast('请书写签名!'); |
| | | } |
| | | this._brushingGround(() => { |
| | | const delta = 20; |
| | | const clipArea = { x: 0, y: 0, w: 0, h: 0 }; |
| | | clipArea.x = Math.max(this.cutArea.left - delta, 0); |
| | |
| | | this.layerOpened = false; |
| | | }, |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | | mounted() { |