diff --git a/packages/x6/src/graph/renderer.ts b/packages/x6/src/graph/renderer.ts index 1cf446dc14d..faf18a19634 100644 --- a/packages/x6/src/graph/renderer.ts +++ b/packages/x6/src/graph/renderer.ts @@ -1190,6 +1190,11 @@ export class Renderer extends Base { const bbox = Dom.getBBox(view.container as SVGElement, { target: this.view.stage, }) + if (bbox.width === 0) { + bbox.inflate(1, 0) + } else if (bbox.height === 0) { + bbox.inflate(0, 1) + } return options.strict ? area.containsRect(bbox) : area.isIntersectWithRect(bbox) diff --git a/packages/x6/src/model/model.ts b/packages/x6/src/model/model.ts index 5dc7d4a4c19..208b2a9caf9 100644 --- a/packages/x6/src/model/model.ts +++ b/packages/x6/src/model/model.ts @@ -1010,6 +1010,11 @@ export class Model extends Basecoat { const strict = opts && opts.strict return this.getEdges().filter((edge) => { const bbox = edge.getBBox() + if (bbox.width === 0) { + bbox.inflate(1, 0) + } else if (bbox.height === 0) { + bbox.inflate(0, 1) + } return strict ? rect.containsRect(bbox) : rect.isIntersectWithRect(bbox) }) }