fix: 重新下载图片时重新设置图片框高

This commit is contained in:
CPPAlien 2019-11-26 14:58:15 +08:00
parent 6e838701fb
commit 1b3ba56cf6

View File

@ -235,11 +235,16 @@ 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 = doView.url wx.getImageInfo({
doView.url = path; src: path,
newVal.sHeight && (doView.sHeight = newVal.sHeight); success: () => {
newVal.sWidth && (doView.sWidth = newVal.sWidth); doView.originUrl = newVal.url
this.reDraw(doView, callback, isMoving) doView.url = path;
newVal.sHeight && (doView.sHeight = newVal.sHeight);
newVal.sWidth && (doView.sWidth = newVal.sWidth);
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);
@ -256,7 +261,7 @@ Component({
} }
const pen = new Pen(this.globalContext, draw); const pen = new Pen(this.globalContext, draw);
if (isMoving && this.currentPalette.views[0].type === 'text') { if (isMoving && doView.type === 'text') {
pen.paint(callback, true, this.movingCache); pen.paint(callback, true, this.movingCache);
} else { } else {
pen.paint(callback) pen.paint(callback)
@ -646,7 +651,7 @@ Component({
view.originUrl = view.url; view.originUrl = view.url;
view.url = path; view.url = path;
wx.getImageInfo({ wx.getImageInfo({
src: view.url, src: path,
success: (res) => { success: (res) => {
// 获得一下图片信息,供后续裁减使用 // 获得一下图片信息,供后续裁减使用
view.sWidth = res.width; view.sWidth = res.width;