修复图片更新刷新长宽问题
This commit is contained in:
parent
6657c1c05e
commit
0ca93907d2
20
painter.js
20
painter.js
@ -85,7 +85,7 @@ Component({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
observer: function (needClear) {
|
observer: function (needClear) {
|
||||||
if (needClear && !this.needClear) {
|
if (needClear && !this.needClear) {
|
||||||
if (this.frontContext) {
|
if (this.frontContext) {
|
||||||
this.frontContext.draw()
|
this.frontContext.draw()
|
||||||
this.touchedView = {};
|
this.touchedView = {};
|
||||||
this.prevFindedIndex = this.findedIndex
|
this.prevFindedIndex = this.findedIndex
|
||||||
@ -269,16 +269,22 @@ Component({
|
|||||||
}
|
}
|
||||||
if (newVal && newVal.url && doView.url && newVal.url !== doView.url) {
|
if (newVal && newVal.url && doView.url && newVal.url !== doView.url) {
|
||||||
downloader.download(newVal.url, this.properties.LRU).then((path) => {
|
downloader.download(newVal.url, this.properties.LRU).then((path) => {
|
||||||
|
doView.originUrl = newVal.url
|
||||||
|
doView.url = path;
|
||||||
wx.getImageInfo({
|
wx.getImageInfo({
|
||||||
src: path,
|
src: path,
|
||||||
success: () => {
|
success: (res) => {
|
||||||
doView.originUrl = newVal.url
|
doView.sHeight = res.height
|
||||||
doView.url = path;
|
doView.sWidth = res.width
|
||||||
newVal.sHeight && (doView.sHeight = newVal.sHeight);
|
|
||||||
newVal.sWidth && (doView.sWidth = newVal.sWidth);
|
|
||||||
this.reDraw(doView, callback, isMoving)
|
this.reDraw(doView, callback, isMoving)
|
||||||
},
|
},
|
||||||
|
fail: () => {
|
||||||
|
this.reDraw(doView, callback, isMoving)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
// 未下载成功,直接绘制
|
||||||
|
this.reDraw(doView, callback, isMoving)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
(newVal && newVal.text && doView.text && newVal.text !== doView.text) && (doView.text = newVal.text);
|
(newVal && newVal.text && doView.text && newVal.text !== doView.text) && (doView.text = newVal.text);
|
||||||
@ -809,4 +815,4 @@ function setStringPrototype(screenK, scale) {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user