From 2fd3f071e11c2377f1b7e7a63bade1056e29765b Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Fri, 5 Jan 2024 15:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/packages/Train/Train.js | 8 ++++---- src/packages/Train/Train.ts | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/components/packages/Train/Train.js b/components/packages/Train/Train.js index 13a81ff..24cef17 100644 --- a/components/packages/Train/Train.js +++ b/components/packages/Train/Train.js @@ -112,11 +112,11 @@ class TrainBody extends Container { this.bodyRact.clear(); } getBodyWH() { - const bodyAWH = this.codeAGraph.getLocalBounds(); - const bodyBWH = this.codeBGraph.getLocalBounds(); + const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints(); + const bodyBWH = this.codeBGraph.localBoundsToCanvasPoints(); return { - width: bodyAWH.width + bodyBWH.width + this.train.constDatas.bodyPadding * 2, - height: bodyAWH.height + this.train.constDatas.bodyPadding * 2, + width: bodyAWH[1].x - bodyAWH[0].x + bodyBWH[1].x - bodyBWH[0].x, + height: bodyAWH[2].y - bodyAWH[1].y, }; } doRepaint() { diff --git a/src/packages/Train/Train.ts b/src/packages/Train/Train.ts index eaad4e0..7e1f77a 100644 --- a/src/packages/Train/Train.ts +++ b/src/packages/Train/Train.ts @@ -128,12 +128,11 @@ class TrainBody extends Container { } getBodyWH(): bodyWH { - const bodyAWH = this.codeAGraph.getLocalBounds(); - const bodyBWH = this.codeBGraph.getLocalBounds(); + const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints(); + const bodyBWH = this.codeBGraph.localBoundsToCanvasPoints(); return { - width: - bodyAWH.width + bodyBWH.width + this.train.constDatas.bodyPadding * 2, - height: bodyAWH.height + this.train.constDatas.bodyPadding * 2, + width: bodyAWH[1].x - bodyAWH[0].x + bodyBWH[1].x - bodyBWH[0].x, + height: bodyAWH[2].y - bodyAWH[1].y, }; }