Skip to content

Decision-node branch edges exit bottom apex and S-jog through sibling label (TD flowchart) #123

Description

@pravinbansal-pt

Summary

In a top-down flowchart, both outgoing edges of a decision (diamond) node exit from the node's bottom apex. When one branch needs a lateral lane (its target is offset sideways), that edge performs a tight S-jog immediately at the apex before running down to its lane. Two visible problems:

  1. The double-bend sits right at the shape boundary and reads as a kink, not a routed curve.
  2. The lateral branch's jog crosses through the vertical branch's edge label at some font metrics (reproduced with font_size ≈ 14.7).

This is distinct from #122 (arrowhead terminating on the target's top border) — this is about the exit geometry at the decision node, independent of the target-side attachment.

MWE (repro.mmd)

flowchart TD
start(Need flowchart) --> drawn{Have a<br>drawing or<br>draft flowchart?}
drawn -->|No| createDraft[Make a draft]
drawn -->|Yes| ai[Provide to AI<br>and create flowchart]
createDraft --> ai

ai --> improve{Needs<br>improvement?}
improve -->|Yes| drawn
improve -->|No| e(End)
mmdr -i repro.mmd -o out.png -e png -t modern --nodeSpacing 100 --rankSpacing 80

The Yes edge leaves drawn's bottom apex and jogs right immediately, passing beside/over the No label, then drops into its lane toward ai.

Config knobs tried (no effect on the apex S-jog)

All produce an identical render (v0.3.1, -t modern, --nodeSpacing 100 --rankSpacing 80):

  • flowchart.port_side_bias: 4, 8, 14 — apex exits appear to bypass the side-bias offset
  • flowchart.port_pad_max / port_pad_ratio raised (60 / 0.45)
  • flowchart.routing.turn_penalty: 0.630
  • flowchart.routing.enable_grid_router: false
  • flowchart.routing.grid_cell: 8
  • flowchart.objective.edge_gap_floor_ratio: 0.6, edge_label_weight: 3
  • --nodeSpacing 160 --rankSpacing 90

Expected (mermaid-js parity)

A decision node's branch edges leave from the side vertices (or fan out gradually from the apex), so the lateral branch curves away smoothly and never crosses the sibling branch's label.

Suggestion

Assign decision-node branch exits to the left/right vertices when a branch's target lane is lateral; or defer the lateral shift until below the edge-label band so the jog doesn't collide with labels.

Related: #122 (target-side attachment on the same MWE).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions