虚拟计轴为红色

This commit is contained in:
joylink_zhaoerwei 2023-08-08 16:58:22 +08:00
parent 8abb01a1c1
commit b3c7646fba

View File

@ -29,6 +29,7 @@ export const AxleCountingConsts = {
radius: 6, radius: 6,
borderWidth: 1, borderWidth: 1,
circleColorBlue: '0x08F80D', circleColorBlue: '0x08F80D',
circleColorRed: '0xff0000',
codeColor: '0xF48815', codeColor: '0xF48815',
codeFontSize: 22, codeFontSize: 22,
codeOffsetY: 30, codeOffsetY: 30,
@ -47,23 +48,28 @@ class TwoCircleGraphic extends Container {
this.addChild(this.circleB); this.addChild(this.circleB);
this.addChild(this.line); this.addChild(this.line);
} }
draw(): void { draw(invent: boolean): void {
this.drawCircle(this.circleA); this.drawCircle(this.circleA, invent);
this.drawCircle(this.circleB); this.drawCircle(this.circleB, invent);
this.circleA.position.set(-12, 0); this.circleA.position.set(-12, 0);
this.circleB.position.set(12, 0); this.circleB.position.set(12, 0);
this.line.clear(); 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.moveTo(-24, 0);
this.line.lineTo(24, 0); this.line.lineTo(24, 0);
} }
drawCircle(circle: Graphics): void { drawCircle(circle: Graphics, invent: boolean): void {
circle.clear(); circle.clear();
circle.lineStyle( let color = AxleCountingConsts.circleColorBlue;
AxleCountingConsts.borderWidth, if (invent) {
new Color(AxleCountingConsts.circleColorBlue) color = AxleCountingConsts.circleColorRed;
); }
circle.beginFill(AxleCountingConsts.circleColorBlue, 1); circle.lineStyle(AxleCountingConsts.borderWidth, new Color(color));
circle.beginFill(color, 1);
circle.drawCircle(0, 0, AxleCountingConsts.radius); circle.drawCircle(0, 0, AxleCountingConsts.radius);
circle.endFill; circle.endFill;
} }
@ -89,7 +95,7 @@ export class AxleCounting extends JlGraphic {
return this.getDatas<IAxleCountingData>(); return this.getDatas<IAxleCountingData>();
} }
doRepaint(): void { doRepaint(): void {
this.twoCircle.draw(); this.twoCircle.draw(this.datas.invent);
} }
loadRelations(): void { loadRelations(): void {
if (this.datas.axleCountingRef.length) { if (this.datas.axleCountingRef.length) {