Skip to content

Conversation

abdul99ahad
Copy link
Contributor

@abdul99ahad abdul99ahad commented Oct 14, 2024

Related to bpmn-js: #2239

Proposed Changes

  • Implemented support for handling TRBL coordinates in flow elements.
  • Added test cases for TRBL handling, covering both shapes and connections.

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Oct 14, 2024
@abdul99ahad abdul99ahad force-pushed the trbl-flow-elements branch 2 times, most recently from 0d155dc to 07d093b Compare October 14, 2024 15:58
@abdul99ahad
Copy link
Contributor Author

@barmac, all test cases are passing locally, but here it's encountering a single test failure in the CI environment.

@nikku
Copy link
Member

nikku commented Oct 15, 2024

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.

* @return {RectTRBL}
*/
export function asTRBL(bounds) {
if (isConnection(bounds)) {
Copy link
Contributor

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.

@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Oct 15, 2024
@abdul99ahad
Copy link
Contributor Author

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.

Completely agreed. The connection coordinates should be handled through separate method. I'll update it.

Related to bpmn-js: #2239
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Oct 15, 2024
return acc;
}, { x: 0, y: 0 });

return {
Copy link
Member

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?

Copy link
Member

@nikku nikku Oct 15, 2024

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@abdul99ahad abdul99ahad Oct 15, 2024

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.
Oct-14-2024 19-12-12

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.

Copy link
Member

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)?

Copy link
Contributor Author

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.

@nikku nikku marked this pull request as draft October 16, 2024 07:25
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed needs review Review pending labels Oct 16, 2024
@nikku
Copy link
Member

nikku commented Oct 16, 2024

@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 ISSUE_PHASES docs.

@abdul99ahad
Copy link
Contributor Author

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!

@bpmn-io-tasks bpmn-io-tasks bot removed the in progress Currently worked on label Oct 16, 2024
@abdul99ahad abdul99ahad added the wontfix This will not be worked on label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants