clientIO / clientIO/joint

[Bug]: Link's getBBox returns incorrect value

Open
#2,820 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

technical debt
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
  1. Create two elements
  2. Link them
  3. Modify the anchor points of the link
  4. link.getBBox() returns incorrect values
Version

4.0.1 jointplus

bbox

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.