prmr / JetUML

A desktop application for fast UML diagramming.
GNU General Public License v3.0
619 stars 121 forks source link

Correct middle label placement for straight segmented edges #504

Closed prmr closed 1 year ago

prmr commented 1 year ago

Description

Label placement calculations for segmented edges is not trivial. To look good, the middle label's position needs to depend on the geometry of the edge. image

The label is centered on the middle segment if horizontal, and to the right and slightly offset from the middle if vertical.

However, when the diagram geometry results in a straight edge, this formula makes the label appear off-center

image

We need to detect when edges are straight (no middle segment) and position the edge intuitively in such cases.

Configuration