From 12f0bdf6d25f80b0a82f029aee6d8ba03266ec44 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 10 Jan 2024 16:30:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E5=90=B8=E9=99=84=E7=82=B9?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/graphics/section/SectionDrawAssistant.ts | 31 ++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/graphics/section/SectionDrawAssistant.ts b/src/graphics/section/SectionDrawAssistant.ts index 9b7a126..8a3ad65 100644 --- a/src/graphics/section/SectionDrawAssistant.ts +++ b/src/graphics/section/SectionDrawAssistant.ts @@ -244,18 +244,25 @@ export class SectionGraphicHitArea implements IHitArea { function buildAbsorbablePositions(section: Section): AbsorbablePosition[] { const aps: AbsorbablePosition[] = []; - const sections = section.queryStore.queryByType
(Section.Type); - sections.forEach((other) => { - const [ps, pe] = [ - 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 ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height }); - 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 [ps, pe] = [ + 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 }); + const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height }); + 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.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.Type);