区段吸附点修改

This commit is contained in:
joylink_zhaoerwei 2024-01-10 16:30:37 +08:00
parent e699ac3ef3
commit 12f0bdf6d2

View File

@ -244,11 +244,9 @@ export class SectionGraphicHitArea implements IHitArea {
function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = [];
const sections = section.queryStore.queryByType<Section>(Section.Type);
sections.forEach((other) => {
const [ps, pe] = [
other.localToCanvasPoint(other.getStartPoint()),
other.localToCanvasPoint(other.getEndPoint()),
section.localToCanvasPoint(section.getStartPoint()),
section.localToCanvasPoint(section.getEndPoint()),
];
const { width, height } = section.getGraphicApp().canvas;
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
@ -256,6 +254,15 @@ function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
const xe = new AbsorbableLine({ x: 0, y: pe.y }, { x: width, y: pe.y });
const ye = new AbsorbableLine({ x: pe.x, y: 0 }, { x: pe.x, y: height });
aps.push(xs, ys, xe, ye);
const sections = section.queryStore
.queryByType<Section>(Section.Type)
.filter((g) => g.datas.sectionType == SectionType.Physical);
sections.forEach((item) => {
if (item.id !== section.id) {
item.localToCanvasPoints(...item.datas.points).forEach((p) => {
aps.push(new AbsorbablePoint(p));
});
}
});
const turnouts = section.queryStore.queryByType<Turnout>(Turnout.Type);