-
Notifications
You must be signed in to change notification settings - Fork 438
fix: asTRBL supported for flow elements #940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0d155dc
to
07d093b
Compare
@barmac, all test cases are passing locally, but here it's encountering a single test failure in the CI environment. |
Interesting, but is this the way we want to approach things? The utility clearly converts RECT|Point to TRBL, not a connection. I'd rather expose additional utilities to compute the TRBL from a connection. |
lib/layout/LayoutUtil.js
Outdated
* @return {RectTRBL} | ||
*/ | ||
export function asTRBL(bounds) { | ||
if (isConnection(bounds)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the parameter is documented as @param {Point|Rect} bounds
I wouldn't expect to get a connection here. We should look into why a connection ends up getting passed to this function.
Completely agreed. The connection coordinates should be handled through separate method. I'll update it. |
Related to bpmn-js: #2239
07d093b
to
9230d53
Compare
return acc; | ||
}, { x: 0, y: 0 }); | ||
|
||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TRBL
stands for "top, right, bottom, left. I don't think that this is what we want to accomplish here, right?
What do you want to accomplish? I assume you want to compute the bounding box (bounds
, Rect
) of a connection, and once you have it, you can feed that into asTRBL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or would you like to compute the "mid" of an element? This is available, too, so you just need a utility to compute the connection bounds, and chain things together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what we want to accomplish. I wasn't aware that you can calculate bounding box for a connection, I thought it's just for element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is when you move the annotation from the flow that has label to it, and put on top of the label. The label should move downwards to the flow.
Currently, it's giving error cuz when annotation is moved some events emit to move label as well. A connection is passed in asTRBL and returns NaN since it's not designed to handle connections. What my approach was to handle asTRBL to support connections as well. If it's handled, then it can appropriately align the label to optimal position. The function of TRBL is just to return the current coordinates if it does, we are handling rest in bpmn-js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who exactly passes the connection into the asTRBL
function (which is unsupported)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AdaptiveLabelPositioningBehavior in bpmn-js passes the flow element to get TRBL to facilitate positioning of label.
@abdul99ahad Given what we discussed I don't see clearly what you see as the root cause for bpmn-io/bpmn-js#2241 and what solution approaches you considered. Let's sync on your root cause analysis + solution approach along our |
Had a discussion with Nico, reached to the conclusion that it's not feasible to handle complex connection labels adjustment right now. It will be a feature request sometime in future. Closing this PR! |
Related to bpmn-js: #2239
Proposed Changes
Checklist
To ensure you provided everything we need to look at your PR:
@bpmn-io/sr
toolCloses {LINK_TO_ISSUE}
orRelated to {LINK_TO_ISSUE}