prmr / JetUML

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

#446 Improvements to Edge Label Alignment and Layout #447

Closed delphinepilon closed 2 years ago

delphinepilon commented 2 years ago

The line lengths of LabeledStraightEdges, SegmentedEdges, and StateTransitionEdges is now determined dynamically based on the horizontal and vertical distances between the two points that the segment relates. During this code addition, it was noticed that some code for StateTransitionEdge label wrapping was unreachable so it was removed.

The labels of horizontal segments now hover above the arrowhead to match the behaviour of vertical segment labels.

The labels of SegmentedEdges no longer overlaps with the segments themselves. Logic was added to the relevant method to be able to differentiate between a "step up" segment and a "step down" segment. Before the modifications of this pull request, the behaviour was different for two same nodes connected by an edge when the nodes were inverted left to right in the diagram.

Unit tests were added to cover all lines of code added.

Demo for class diagram:

https://user-images.githubusercontent.com/43301868/142680455-647895e7-ab60-4190-8c3f-7de73e2c7668.mov

Demo for state diagram:

https://user-images.githubusercontent.com/43301868/142680445-14a55205-7b3c-4431-85ea-8c4e5b2de85b.mov