From bc24dab84ed8148ae4a04ff751f23691bce3a898 Mon Sep 17 00:00:00 2001 From: dongqing Date: Thu, 5 Dec 2019 09:54:40 +0800 Subject: [PATCH 1/4] fix --- painter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/painter.js b/painter.js index 5caa934..786cc84 100644 --- a/painter.js +++ b/painter.js @@ -66,7 +66,7 @@ Component({ action: { type: Object, observer: function (newVal, oldVal) { - if (newVal) { + if (newVal && !this.isEmpty(newVal)) { this.doAction(newVal, (callbackInfo) => { this.movingCache = callbackInfo }, false, true) @@ -268,7 +268,7 @@ Component({ } if (newVal && newVal.url && doView.url && newVal.url !== doView.url) { downloader.download(newVal.url, this.properties.LRU).then((path) => { - if (newVal.url.startsWidth('https')) { + if (newVal.url.startsWith('https')) { doView.originUrl = newVal.url } doView.url = path; @@ -283,8 +283,9 @@ Component({ this.reDraw(doView, callback, isMoving) } }) - }).catch(() => { + }).catch((error) => { // 未下载成功,直接绘制 + console.error(error) this.reDraw(doView, callback, isMoving) }) } else { From 30a370cfe0a721b3c7ee2e9c2e8c94f64afa4f88 Mon Sep 17 00:00:00 2001 From: dongqing Date: Thu, 5 Dec 2019 10:20:03 +0800 Subject: [PATCH 2/4] =?UTF-8?q?init=20dance=20=E6=9C=9F=E9=97=B4=E7=A6=81?= =?UTF-8?q?=E6=8E=89=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- painter.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/painter.js b/painter.js index 3d35aec..c4ba770 100644 --- a/painter.js +++ b/painter.js @@ -615,6 +615,7 @@ Component({ }, initDancePalette() { + this.isDisabled = true; this.initScreenK(); this.downloadImages(this.properties.dancePalette).then((palette) => { this.currentPalette = palette @@ -635,6 +636,7 @@ Component({ this.topContext || (this.topContext = wx.createCanvasContext('top', this)); this.globalContext || (this.globalContext = wx.createCanvasContext('k-canvas', this)); new Pen(this.bottomContext, palette).paint(() => { + this.isDisabled = false; this.triggerEvent('didShow'); }); this.globalContext.draw(); From bead9644c56575c7670d1ef1cc2762f73c34e683 Mon Sep 17 00:00:00 2001 From: dongqing Date: Thu, 5 Dec 2019 10:36:10 +0800 Subject: [PATCH 3/4] fix --- lib/pen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pen.js b/lib/pen.js index 4bfed02..47f8c1f 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -547,7 +547,7 @@ export default class Painter { } let lineIndex = 0; for (let j = 0; j < textArray.length; ++j) { - const preLineLength = Math.floor(textArray[j].length / linesArray[j]); + const preLineLength = Math.ceil(textArray[j].length / linesArray[j]); let start = 0; let alreadyCount = 0; for (let i = 0; i < linesArray[j]; ++i) { From 54e854d1bfe367173a11ef2956bafa675ee7fa12 Mon Sep 17 00:00:00 2001 From: dongqing Date: Thu, 5 Dec 2019 14:13:39 +0800 Subject: [PATCH 4/4] fix --- lib/pen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pen.js b/lib/pen.js index 47f8c1f..b47d573 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -204,7 +204,7 @@ export default class Painter { for (let i = 0; i < textArray.length; ++i) { const textLength = this.ctx.measureText(textArray[i]).width; let partWidth = view.css.width ? view.css.width.toPx(false, this.style.width) - paddings[1] - paddings[3] : textLength; - partWidth = partWidth > fontSize ? partWidth - partWidth % fontSize + fontSize : fontSize + // partWidth = partWidth > fontSize ? partWidth - partWidth % fontSize + fontSize : fontSize const calLines = Math.ceil(textLength / partWidth); // 取最长的作为 width width = partWidth > width ? partWidth : width;