From 36ce87fe209b7064021e93ea15e08ddcc30f796b Mon Sep 17 00:00:00 2001 From: dongqing Date: Wed, 4 Dec 2019 14:48:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=B4=E9=9C=B2palette=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pen.js | 2 +- painter.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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) { diff --git a/painter.js b/painter.js index e24902c..3a73580 100644 --- a/painter.js +++ b/painter.js @@ -630,7 +630,9 @@ Component({ this.bottomContext || (this.bottomContext = wx.createCanvasContext('bottom', this)); this.topContext || (this.topContext = wx.createCanvasContext('top', this)); this.globalContext || (this.globalContext = wx.createCanvasContext('k-canvas', this)); - new Pen(this.bottomContext, palette).paint(); + new Pen(this.bottomContext, palette).paint(() => { + this.triggerEvent('didShow'); + }); new Pen(this.globalContext, { width, height,