Skip to content

Conversation

@omkarht
Copy link
Contributor

@omkarht omkarht commented Nov 10, 2025

📑 Summary

This PR fixes critical autonumber positioning issues for sequence diagrams across all arrow types, adds missing helper functions, and improves actor rendering consistency.

Key Changes:

1. Fixed Autonumber Positioning (sequenceRenderer.ts)

  • Bidirectional arrows: Adjusted line start position with proper radius offset and central connection spacing
  • Reverse arrows: Corrected line stop position at arrowhead with special handling for central connections
  • Normal arrows: Maintained consistent positioning with radius offset
  • Self-reference arrows: Fixed line start offset for reverse and bidirectional types when autonumber is enabled
  • Autonumber placement: Calculated correct X position based on message direction, arrow type, and actor bounds

2. Enhanced Central Connection Rendering (sequenceRenderer.ts)

  • Implemented dynamic circle positioning when autonumber is enabled
  • Added getCircleOffset() helper function with directional logic (LTR/RTL)
  • Proper offset calculations for:
    • CENTRAL_CONNECTION - circle at destination
    • CENTRAL_CONNECTION_REVERSE - circle at source
    • CENTRAL_CONNECTION_DUAL - circles at both ends
  • Handles reverse arrows with inverted offsets

3. Improved Actor Rendering (svgDraw.js)

  • Control actor: Increased radius (18→22), adjusted vertical positioning
  • Entity actor: Increased radius (18→22), removed hardcoded stroke color, improved text positioning
  • Database actor: Optimized cylinder dimensions (w/4→w/3), centered positioning, consistent text placement
  • Boundary actor: Adjusted radius (30→22), improved stick figure positioning and alignment

Resolves #

📏 Design Decisions

Describe the way your implementation works or what design decisions you made if applicable.

📋 Tasks

Make sure you

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation. Make sure MERMAID_RELEASE_VERSION is used for all new features.
  • 🦋 If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Nov 10, 2025

⚠️ No Changeset found

Latest commit: de54798

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Nov 10, 2025

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit de54798
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/692586dee7513a00081fda10
😎 Deploy Preview https://deploy-preview-7150--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added Type: Bug / Error Something isn't working or is incorrect Sponsored by MermaidChart labels Nov 10, 2025
@omkarht omkarht changed the title fix : improved actor rendering and autonumber positioning for all types of arrows and central connections fix : improved sequence diagram new actors rendering and autonumber positioning for all types of arrows and central connections Nov 10, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 10, 2025

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/examples@7150

mermaid

npm i https://pkg.pr.new/mermaid-js/mermaid@7150

@mermaid-js/layout-elk

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-elk@7150

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/layout-tidy-tree@7150

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/mermaid-zenuml@7150

@mermaid-js/parser

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/parser@7150

@mermaid-js/tiny

npm i https://pkg.pr.new/mermaid-js/mermaid/@mermaid-js/tiny@7150

commit: de54798

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 0% with 133 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.54%. Comparing base (2346801) to head (de54798).

Files with missing lines Patch % Lines
.../mermaid/src/diagrams/sequence/sequenceRenderer.ts 0.00% 112 Missing ⚠️
packages/mermaid/src/diagrams/sequence/svgDraw.js 0.00% 21 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #7150      +/-   ##
==========================================
- Coverage     3.55%   3.54%   -0.01%     
==========================================
  Files          473     474       +1     
  Lines        47500   47599      +99     
  Branches       731     731              
==========================================
  Hits          1687    1687              
- Misses       45813   45912      +99     
Flag Coverage Δ
unit 3.54% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/diagrams/sequence/svgDraw.js 0.00% <0.00%> (ø)
.../mermaid/src/diagrams/sequence/sequenceRenderer.ts 0.06% <0.00%> (-0.01%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci
Copy link

argos-ci bot commented Nov 10, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 46 changed, 28 added Nov 25, 2025, 10:48 AM

@omkarht omkarht marked this pull request as ready for review November 11, 2025 13:48
…fix/sequence-diagram-autonumber-arrow-positioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Sponsored by MermaidChart Type: Bug / Error Something isn't working or is incorrect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants