From 6dc9e69fa1ae6f4af8f6a087f6baeef70b5262fe Mon Sep 17 00:00:00 2001 From: 0JARVIS0 <709406687@qq.com> Date: Tue, 26 Nov 2019 11:20:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=80=89=E4=B8=AD=E6=A1=86=E9=94=99=E4=BD=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pen.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/pen.js b/lib/pen.js index 8535907..3a8b7f4 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -332,13 +332,19 @@ export default class Painter { } else if (align === 'right') { left = x - width } + var top = y; + if (verticalAlign === 'center') { + top = y - height / 2; + } else if (verticalAlign === 'bottom') { + top = y - height + } view.rect = { - left, - top: y, + left: left, + top: top, right: left + width, - bottom: y + height, - x: view.css && view.css.right ? (x - width) : x, - y + bottom: top + height, + x: view.css && view.css.right ? x - width : x, + y: y }; const pd = this._doPaddings(view); view.rect.left = view.rect.left - pd[3];