区段吸附点修改
This commit is contained in:
parent
e699ac3ef3
commit
12f0bdf6d2
@ -244,18 +244,25 @@ export class SectionGraphicHitArea implements IHitArea {
|
|||||||
function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
|
function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
|
||||||
const aps: AbsorbablePosition[] = [];
|
const aps: AbsorbablePosition[] = [];
|
||||||
|
|
||||||
const sections = section.queryStore.queryByType<Section>(Section.Type);
|
const [ps, pe] = [
|
||||||
sections.forEach((other) => {
|
section.localToCanvasPoint(section.getStartPoint()),
|
||||||
const [ps, pe] = [
|
section.localToCanvasPoint(section.getEndPoint()),
|
||||||
other.localToCanvasPoint(other.getStartPoint()),
|
];
|
||||||
other.localToCanvasPoint(other.getEndPoint()),
|
const { width, height } = section.getGraphicApp().canvas;
|
||||||
];
|
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
|
||||||
const { width, height } = section.getGraphicApp().canvas;
|
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
|
||||||
const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
|
const xe = new AbsorbableLine({ x: 0, y: pe.y }, { x: width, y: pe.y });
|
||||||
const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
|
const ye = new AbsorbableLine({ x: pe.x, y: 0 }, { x: pe.x, y: height });
|
||||||
const xe = new AbsorbableLine({ x: 0, y: pe.y }, { x: width, y: pe.y });
|
aps.push(xs, ys, xe, ye);
|
||||||
const ye = new AbsorbableLine({ x: pe.x, y: 0 }, { x: pe.x, y: height });
|
const sections = section.queryStore
|
||||||
aps.push(xs, ys, xe, ye);
|
.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);
|
const turnouts = section.queryStore.queryByType<Turnout>(Turnout.Type);
|
||||||
|
Loading…
Reference in New Issue
Block a user