From 2e9a0852cffffa6b29888fbe613d17918aa599eb Mon Sep 17 00:00:00 2001 From: CPPAlien Date: Wed, 25 Dec 2019 14:39:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20view.rect=20=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pen.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/pen.js b/lib/pen.js index 69a9a21..6a663b7 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -359,14 +359,23 @@ export default class Painter { } else if (verticalAlign === 'bottom') { top = y - height } - view.rect = { - left: left, - top: top, - right: left + width, - bottom: top + height, - x: view.css && view.css.right ? x - width : x, - y: y - }; + if (view.rect) { + view.rect.left = left; + view.rect.top = top; + view.rect.right = left + width; + view.rect.bottom = top + height; + view.rect.x = view.css && view.css.right ? x - width : x; + view.rect.y = y; + } else { + view.rect = { + left: left, + top: top, + right: left + width, + bottom: top + height, + x: view.css && view.css.right ? x - width : x, + y: y + }; + } view.rect.left = view.rect.left - paddings[3]; view.rect.top = view.rect.top - paddings[0];