列车调整

This commit is contained in:
dong 2024-01-05 15:48:53 +08:00
parent a59e51eafd
commit 2fd3f071e1
2 changed files with 8 additions and 9 deletions

View File

@ -112,11 +112,11 @@ class TrainBody extends Container {
this.bodyRact.clear(); this.bodyRact.clear();
} }
getBodyWH() { getBodyWH() {
const bodyAWH = this.codeAGraph.getLocalBounds(); const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints();
const bodyBWH = this.codeBGraph.getLocalBounds(); const bodyBWH = this.codeBGraph.localBoundsToCanvasPoints();
return { return {
width: bodyAWH.width + bodyBWH.width + this.train.constDatas.bodyPadding * 2, width: bodyAWH[1].x - bodyAWH[0].x + bodyBWH[1].x - bodyBWH[0].x,
height: bodyAWH.height + this.train.constDatas.bodyPadding * 2, height: bodyAWH[2].y - bodyAWH[1].y,
}; };
} }
doRepaint() { doRepaint() {

View File

@ -128,12 +128,11 @@ class TrainBody extends Container {
} }
getBodyWH(): bodyWH { getBodyWH(): bodyWH {
const bodyAWH = this.codeAGraph.getLocalBounds(); const bodyAWH = this.codeAGraph.localBoundsToCanvasPoints();
const bodyBWH = this.codeBGraph.getLocalBounds(); const bodyBWH = this.codeBGraph.localBoundsToCanvasPoints();
return { return {
width: width: bodyAWH[1].x - bodyAWH[0].x + bodyBWH[1].x - bodyBWH[0].x,
bodyAWH.width + bodyBWH.width + this.train.constDatas.bodyPadding * 2, height: bodyAWH[2].y - bodyAWH[1].y,
height: bodyAWH.height + this.train.constDatas.bodyPadding * 2,
}; };
} }