车次窗方向

This commit is contained in:
joylink_zhaoerwei 2023-06-20 09:10:58 +08:00
parent 553bcb4307
commit 3b337a7834

View File

@ -102,13 +102,17 @@ export class TrainWindowDraw extends GraphicDrawAssistant<
this.app.deleteGraphics(...trainWindowAll); this.app.deleteGraphics(...trainWindowAll);
sections.forEach((section) => { sections.forEach((section) => {
const points = section.datas.points; const points = section.datas.points;
let direction = 1;
if (points[0].y > 540) {
direction = -1;
}
for (let i = 0; i < points.length - 1; i++) { for (let i = 0; i < points.length - 1; i++) {
const x = (points[i].x + points[i + 1].x) / 2; const x = (points[i].x + points[i + 1].x) / 2;
const trainWindow = new TrainWindow(); const trainWindow = new TrainWindow();
trainWindow.loadData(this.createGraphicData()); trainWindow.loadData(this.createGraphicData());
trainWindow.position.set( trainWindow.position.set(
x, x,
points[i].y - TrainWindowConsts.offsetSection points[i].y - direction * TrainWindowConsts.offsetSection
); );
trainWindow.id = GraphicIdGenerator.next(); trainWindow.id = GraphicIdGenerator.next();
trainWindow.datas.sectionId = section.id; trainWindow.datas.sectionId = section.id;