From b3c7646fba52f4402724c7990737c4761fd8233f Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Tue, 8 Aug 2023 16:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=99=9A=E6=8B=9F=E8=AE=A1=E8=BD=B4=E4=B8=BA?= =?UTF-8?q?=E7=BA=A2=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/axleCounting/AxleCounting.ts | 28 ++++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/graphics/axleCounting/AxleCounting.ts b/src/graphics/axleCounting/AxleCounting.ts index 1550372..b2291d8 100644 --- a/src/graphics/axleCounting/AxleCounting.ts +++ b/src/graphics/axleCounting/AxleCounting.ts @@ -29,6 +29,7 @@ export const AxleCountingConsts = { radius: 6, borderWidth: 1, circleColorBlue: '0x08F80D', + circleColorRed: '0xff0000', codeColor: '0xF48815', codeFontSize: 22, codeOffsetY: 30, @@ -47,23 +48,28 @@ class TwoCircleGraphic extends Container { this.addChild(this.circleB); this.addChild(this.line); } - draw(): void { - this.drawCircle(this.circleA); - this.drawCircle(this.circleB); + draw(invent: boolean): void { + this.drawCircle(this.circleA, invent); + this.drawCircle(this.circleB, invent); this.circleA.position.set(-12, 0); this.circleB.position.set(12, 0); this.line.clear(); - this.line.lineStyle(1, new Color(AxleCountingConsts.circleColorBlue)); + let color = AxleCountingConsts.circleColorBlue; + if (invent) { + color = AxleCountingConsts.circleColorRed; + } + this.line.lineStyle(1, new Color(color)); this.line.moveTo(-24, 0); this.line.lineTo(24, 0); } - drawCircle(circle: Graphics): void { + drawCircle(circle: Graphics, invent: boolean): void { circle.clear(); - circle.lineStyle( - AxleCountingConsts.borderWidth, - new Color(AxleCountingConsts.circleColorBlue) - ); - circle.beginFill(AxleCountingConsts.circleColorBlue, 1); + let color = AxleCountingConsts.circleColorBlue; + if (invent) { + color = AxleCountingConsts.circleColorRed; + } + circle.lineStyle(AxleCountingConsts.borderWidth, new Color(color)); + circle.beginFill(color, 1); circle.drawCircle(0, 0, AxleCountingConsts.radius); circle.endFill; } @@ -89,7 +95,7 @@ export class AxleCounting extends JlGraphic { return this.getDatas(); } doRepaint(): void { - this.twoCircle.draw(); + this.twoCircle.draw(this.datas.invent); } loadRelations(): void { if (this.datas.axleCountingRef.length) {