[Bug]: Link's getBBox returns incorrect value
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.4k
- Forks
- 893
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 26
Description
I need to use the bboxes of the links to be able to clip them.
I simply tried: link.getBBox() which seems to return an incorrect value.
Further investigation reveals that getPointFromConnectedLink always returns on this line if there is no port id: if (!portId || !this.hasPort(portId)) return center;
Why is the endDef not taken into account in this case and instead it takes the center of the element(s)?
Thanks.
Steps to reproduce
- Create two elements
- Link them
- Modify the anchor points of the link
link.getBBox()returns incorrect values
Version
4.0.1 jointplus
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing link.getBBox() into getPointFromConnectedLink, focusing on the early return when no port id is present and how endDef is handled. Reproduce the reported case with two elements and modified anchor points, then verify that the computed bounding box reflects the link endpoints rather than only element centers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100