道岔单封边框

This commit is contained in:
Yuan 2023-07-26 17:06:28 +08:00
parent 5afc6b59c2
commit 732b3fe34d

View File

@ -253,6 +253,7 @@ export class Turnout extends JlGraphic {
this.graphics.label.transformSave = true;
this.graphics.label.name = 'label';
this.addChild(this.graphics.label);
this.addChild(this.graphics.labelRect);
}
get code(): string {
@ -295,8 +296,16 @@ export class Turnout extends JlGraphic {
}
if (this.states.ipSingleSwitchStusBlocked2) {
this.graphics.labelRect.clear().lineStyle(1, '#f00');
const { x, y, width, height } = this.graphics.label.getLocalBounds();
this.graphics.labelRect.drawRect(x, y, width, height);
const { width, height } = this.graphics.label.getLocalBounds();
const { x, y } = this.graphics.label.transform.position;
this.graphics.labelRect.drawRect(
x - width / 2,
y - height / 2,
width,
height
);
} else {
this.graphics.labelRect.clear();
}
}