计轴区段名称显示
This commit is contained in:
parent
b53e27640a
commit
8e15d22360
@ -5,6 +5,7 @@ import {
|
|||||||
JlGraphic,
|
JlGraphic,
|
||||||
JlGraphicTemplate,
|
JlGraphicTemplate,
|
||||||
VectorText,
|
VectorText,
|
||||||
|
calculateLineMidpoint,
|
||||||
} from 'src/jl-graphic';
|
} from 'src/jl-graphic';
|
||||||
import { IRelatedRefData, protoPort2Data } from '../CommonGraphics';
|
import { IRelatedRefData, protoPort2Data } from '../CommonGraphics';
|
||||||
import { SectionPort } from '../section/Section';
|
import { SectionPort } from '../section/Section';
|
||||||
@ -49,7 +50,7 @@ export class AxleCountingSection extends JlGraphic {
|
|||||||
this.labelGraphic = new VectorText();
|
this.labelGraphic = new VectorText();
|
||||||
this.labelGraphic.setVectorFontSize(14);
|
this.labelGraphic.setVectorFontSize(14);
|
||||||
this.labelGraphic.anchor.set(0.5);
|
this.labelGraphic.anchor.set(0.5);
|
||||||
this.labelGraphic.style.fill = '#0f0';
|
this.labelGraphic.style.fill = '0xff0000';
|
||||||
this.labelGraphic.transformSave = true;
|
this.labelGraphic.transformSave = true;
|
||||||
this.labelGraphic.name = 'label';
|
this.labelGraphic.name = 'label';
|
||||||
this.transformSave = true;
|
this.transformSave = true;
|
||||||
@ -83,10 +84,11 @@ export class AxleCountingSection extends JlGraphic {
|
|||||||
if (labelPosition) {
|
if (labelPosition) {
|
||||||
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
this.labelGraphic.position.set(labelPosition.x, labelPosition.y);
|
||||||
} else {
|
} else {
|
||||||
this.labelGraphic.position.set(
|
const centerPos = calculateLineMidpoint(
|
||||||
this.datas.points[0].x,
|
this.datas.points[0],
|
||||||
this.datas.points[0].y + 20
|
this.datas.points[this.datas.points.length - 1]
|
||||||
);
|
);
|
||||||
|
this.labelGraphic.position.set(centerPos.x, centerPos.y + 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get linePoints(): IPointData[] {
|
get linePoints(): IPointData[] {
|
||||||
|
Loading…
Reference in New Issue
Block a user