You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
This behavior is intentional. The bounding box of the link model is only an approximation of the rendered bounding box.
The anchor, connectionPoint, connector, and router cannot be fully accounted for because they might depend on DOM measurements. The link model does not—and should not—have access to the view.
If your anchor relies solely on the model (e.g., modelCenter), you can extend the link class and override the getBBox() method to account for this.
Unless we introduce a new option in the paper to guarantee that no measurements rely on the DOM, or find a way to determine the size of DOM elements without rendering them (including text), this behavior cannot be changed.
I see, makes sense.
Sadly, it doesn't rely solely on modelCenter (the idea shortly flashed in my head, too).
What would give me the most accurate link bbox? paper.paperToLocalRect( linkView.getBBox() );?
And in that case - what would be the cleanest way to get the correctly sized bbox? Listening to render:done? Currently I am doing:
link target change listener : requireView -> measure bbox with the above line
-> this reports wrong size as the view is updated after the target change listener ran its course
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
link.getBBox()
returns incorrect valuesVersion
4.0.1 jointplus
The text was updated successfully, but these errors were encountered: