prmr / JetUML

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

Refactor node position so that x and y are no longer properties #427

Closed prmr closed 3 years ago

prmr commented 3 years ago

In the design of diagram Node elements, the node's position is stored as a two node properties, x and y respectively. This has the advantage of simplifying the encoding and decoding of diagrams, since position values get serialized like all other node attributes. However, this insignificant advantage comes at a great cost:

  1. The x and y properties are "special" because they should not be handled by the property sheet, thus requiring a whole mechanism to handle invisible properties.
  2. It means the Point class cannot be immutable (as it should), because properties have to be mutable.

We can greatly simplify the design of the code by not storing a node's position using properties.