This commit is contained in:
joylink_zhaoerwei 2024-01-10 14:00:23 +08:00
parent fc23bb11d5
commit 81e5c23093

View File

@ -339,22 +339,16 @@ export class SectionGraphicHitArea implements IHitArea {
function buildAbsorbablePositions(section: Section): AbsorbablePosition[] { function buildAbsorbablePositions(section: Section): AbsorbablePosition[] {
const aps: AbsorbablePosition[] = []; const aps: AbsorbablePosition[] = [];
const [ps, pe] = [
const sectionRef = section.relationManage section.localToCanvasPoint(section.getStartPoint()),
.getRelationsOfGraphicAndOtherType(section, Section.Type) section.localToCanvasPoint(section.getEndPoint()),
.map((r) => r.getOtherGraphic<Section>(section)); ];
sectionRef.forEach((other) => { const { width, height } = section.getGraphicApp().canvas;
const [ps, pe] = [ const xs = new AbsorbableLine({ x: 0, y: ps.y }, { x: width, y: ps.y });
other.localToCanvasPoint(other.getStartPoint()), const ys = new AbsorbableLine({ x: ps.x, y: 0 }, { x: ps.x, y: height });
other.localToCanvasPoint(other.getEndPoint()), 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 });
const { width, height } = section.getGraphicApp().canvas; aps.push(xs, ys, xe, ye);
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 const sections = section.queryStore
.queryByType<Section>(Section.Type) .queryByType<Section>(Section.Type)
.filter((g) => g.datas.sectionType == SectionType.Physical); .filter((g) => g.datas.sectionType == SectionType.Physical);