|
@@ -38,7 +38,6 @@ class DrawCanvas {
|
|
|
const X = x - (this._style.w / 2)
|
|
const X = x - (this._style.w / 2)
|
|
|
const Y = y - (this._style.h / 2)
|
|
const Y = y - (this._style.h / 2)
|
|
|
this._ctx.fillRect(X, Y, this._style.w, this._style.h)
|
|
this._ctx.fillRect(X, Y, this._style.w, this._style.h)
|
|
|
- console.log('画图并存储');
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
mouseEnd() {
|
|
mouseEnd() {
|
|
@@ -68,7 +67,7 @@ class DrawCanvas {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 切换画笔
|
|
// 切换画笔
|
|
|
- changeBrush(url = '', w = 10, h = 10, angle = 0) {
|
|
|
|
|
|
|
+ changeBrush({ url = '', w = 10, h = 10, angle = 0 }) {
|
|
|
if (!url) return
|
|
if (!url) return
|
|
|
const img = this._canvas.createImage()
|
|
const img = this._canvas.createImage()
|
|
|
img.onload = () => {
|
|
img.onload = () => {
|
|
@@ -120,14 +119,15 @@ class DrawCanvas {
|
|
|
this._executionArr = []
|
|
this._executionArr = []
|
|
|
this._pathArr = []
|
|
this._pathArr = []
|
|
|
this._style = null
|
|
this._style = null
|
|
|
|
|
+ this._matrix = null
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 保存
|
|
// 保存
|
|
|
- save() {
|
|
|
|
|
|
|
+ save(callBack) {
|
|
|
wx.canvasToTempFilePath({
|
|
wx.canvasToTempFilePath({
|
|
|
canvas: this._canvas,
|
|
canvas: this._canvas,
|
|
|
success(res) {
|
|
success(res) {
|
|
|
- console.log('保存', res.tempFilePath);
|
|
|
|
|
|
|
+ callBack(res)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|