Skip to content

fix(modeling): correct sequence flow layout from corner boundary events#2395

Closed
JhaSourav07 wants to merge 0 commit intobpmn-io:developfrom
JhaSourav07:fix-issue-2270
Closed

fix(modeling): correct sequence flow layout from corner boundary events#2395
JhaSourav07 wants to merge 0 commit intobpmn-io:developfrom
JhaSourav07:fix-issue-2270

Conversation

@JhaSourav07
Copy link
Contributor

Describe the Bug Fixed

This PR fixes an issue where sequence flows starting from a corner boundary event and connecting to an element directly on the same axis (e.g., placed completely below or to the side) would generate an awkward, looping layout with an unnecessary extra waypoint.

What changed
Updated getBoundaryEventTargetLayout in BpmnLayouter.js to explicitly check if a target element is strictly on the same vertical or horizontal axis relative to the boundary event. When it is, the layouter now correctly returns 'v' or 'h', allowing the Manhattan layout engine to draw a clean, straight line instead of detouring out to the side.

Steps to verify:

  1. Attach a boundary event to the corner of a task.
  2. Place another element directly below (or directly to the left/right) of that boundary event.
  3. Connect the boundary event to the new element. The sequence flow will now connect in a straight line without additional waypoints.

Fixes #2270

Before
image

image

After
image

Checklist:

  • The code adheres to our conventions (spaces instead of tabs, single-quotes, ...)
  • The code is tested
  • The npm run all build passes (executes tests + linting)
  • The work is combined into a single commit
  • The commit messages adhere to the conventional commits guidelines

Checklist

Ensure you provide everything we need to review your contribution:

  • Contribution meets our definition of done
  • Pull request establishes context
    • Link to related issue(s), i.e. Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}
    • Brief textual description of the changes
    • [x]] Screenshots or short videos showing UI/UX changes
    • Steps to try out, i.e. using the @bpmn-io/sr tool

@JhaSourav07 JhaSourav07 requested review from a team, barmac, Copilot and pablocabrera85 March 4, 2026 12:47
@CLAassistant
Copy link

CLAassistant commented Mar 4, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes sequence flow Manhattan layout when connecting from a corner-attached boundary event to a target element that is strictly axis-aligned (directly above/below or left/right), avoiding an unnecessary detour waypoint (issue #2270).

Changes:

  • Enhance getBoundaryEventTargetLayout to detect strictly vertical vs strictly horizontal target orientation and return 'v'/'h' accordingly.
  • Preserve existing corner-attachment routing logic for diagonal (corner-to-corner/quadrant) target orientations.
Comments suppressed due to low confidence (1)

lib/features/modeling/BpmnLayouter.js:494

  • The new verticalTargetOrientation / horizontalTargetOrientation values are computed once, but the later comparisons still call getVerticalOrientation(targetOrientation) / getHorizontalOrientation(targetOrientation) again. Consider reusing the already computed values (and similarly caching the attach orientations) to avoid duplicated parsing and keep the logic easier to follow.
  var verticalTargetOrientation = getVerticalOrientation(targetOrientation),
      horizontalTargetOrientation = getHorizontalOrientation(targetOrientation);

  // If the target is strictly above/below (no horizontal orientation)
  if (verticalTargetOrientation && !horizontalTargetOrientation) {
    return 'v';
  }

  // If the target is strictly left/right (no vertical orientation)
  if (horizontalTargetOrientation && !verticalTargetOrientation) {
    return 'h';
  }

  if (isHorizontal) {
    if (isSame(getVerticalOrientation(attachOrientation), getVerticalOrientation(targetOrientation))) {
      return 'h';
    } else {
      return 'v';
    }
  } else {
    if (isSame(getHorizontalOrientation(attachOrientation), getHorizontalOrientation(targetOrientation))) {
      return 'v';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JhaSourav07 JhaSourav07 force-pushed the fix-issue-2270 branch 6 times, most recently from fbb23b0 to a3b8df8 Compare March 4, 2026 13:51
@JhaSourav07 JhaSourav07 requested a review from Copilot March 4, 2026 13:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weird layout of sequence flows starting from boundary events on activity corners due to additional invalid waypoint

3 participants