From 1b3ba56cf63f1d057816cf32d085cd3c2b62f4cd Mon Sep 17 00:00:00 2001 From: CPPAlien Date: Tue, 26 Nov 2019 14:58:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=87=8D=E6=96=B0=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=97=B6=E9=87=8D=E6=96=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=A1=86=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- painter.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/painter.js b/painter.js index 5f659c5..ab7595c 100644 --- a/painter.js +++ b/painter.js @@ -235,11 +235,16 @@ Component({ } if (newVal && newVal.url && doView.url && newVal.url !== doView.url) { downloader.download(newVal.url, this.properties.LRU).then((path) => { - doView.originUrl = doView.url - doView.url = path; - newVal.sHeight && (doView.sHeight = newVal.sHeight); - newVal.sWidth && (doView.sWidth = newVal.sWidth); - this.reDraw(doView, callback, isMoving) + wx.getImageInfo({ + src: path, + success: () => { + doView.originUrl = newVal.url + doView.url = path; + newVal.sHeight && (doView.sHeight = newVal.sHeight); + newVal.sWidth && (doView.sWidth = newVal.sWidth); + this.reDraw(doView, callback, isMoving) + }, + }) }) } else { (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); - if (isMoving && this.currentPalette.views[0].type === 'text') { + if (isMoving && doView.type === 'text') { pen.paint(callback, true, this.movingCache); } else { pen.paint(callback) @@ -646,7 +651,7 @@ Component({ view.originUrl = view.url; view.url = path; wx.getImageInfo({ - src: view.url, + src: path, success: (res) => { // 获得一下图片信息,供后续裁减使用 view.sWidth = res.width;