Merge branch 'master' of git.code.tencent.com:xian-ncc-da/xian-ncc-da-client

This commit is contained in:
Yuan 2023-06-30 11:20:30 +08:00
commit 07b5f97972

View File

@ -133,18 +133,27 @@ export class SeparatorDraw extends GraphicDrawAssistant<
});
}
if (index == allR.length - 1) {
const ps = turnout.getPortPoints();
let isALeft = true; // 判断A端在左还是右
if (ps[0][ps[0].length - 1].x > ps[1][ps[1].length - 1].x) {
isALeft = false;
}
if (!port.includes('A')) {
rMap.set(`${turnout.id}_A`, {
g: turnout,
param: 'A',
separatorType: separatorTypeEnum.endB,
separatorType: isALeft
? separatorTypeEnum.endA
: separatorTypeEnum.endB,
});
}
if (!port.includes('B')) {
rMap.set(`${turnout.id}_B`, {
g: turnout,
param: 'B',
separatorType: separatorTypeEnum.endA,
separatorType: isALeft
? separatorTypeEnum.endB
: separatorTypeEnum.endA,
});
}
}
@ -152,11 +161,6 @@ export class SeparatorDraw extends GraphicDrawAssistant<
});
rMap.forEach((item) => {
if (!item.repetition) {
const sType = item.separatorType || separatorTypeEnum.section;
const separator = new Separator();
const data = new SeparatorData();
data.separatorType = sType;
separator.loadData(data);
let p;
if (item.g.type == Section.Type) {
p = item.g.getStartPoint();
@ -175,12 +179,20 @@ export class SeparatorDraw extends GraphicDrawAssistant<
p = lps[lps.length - 1];
}
const tps = item.g.localToCanvasPoint(p);
separator.position.set(tps.x, tps.y);
separator.id = GraphicIdGenerator.next();
this.storeGraphic(separator);
const sType = item.separatorType || separatorTypeEnum.section;
this.createSeparator(sType, tps);
}
});
}
createSeparator(separatorType: separatorTypeEnum, tps: Point) {
const separator = new Separator();
const data = new SeparatorData();
data.separatorType = separatorType;
separator.loadData(data);
separator.position.set(tps.x, tps.y);
separator.id = GraphicIdGenerator.next();
this.storeGraphic(separator);
}
}
//碰撞检测