Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
prmr opened this issue Apr 29, 2021 · 0 comments
Closed

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

prmr opened this issue Apr 29, 2021 · 0 comments
Assignees
Labels
main Issues with the main code base refactoring A proposal to refector or generally improve the code
Milestone

Comments

@prmr
Copy link
Owner

prmr commented Apr 29, 2021

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.

@prmr prmr added refactoring A proposal to refector or generally improve the code main Issues with the main code base labels Apr 29, 2021
@prmr prmr self-assigned this Apr 29, 2021
@prmr prmr added this to the Release 3.3 milestone Apr 29, 2021
prmr added a commit that referenced this issue Apr 29, 2021
The x and y values for the position of a node are no longer managed as
node properties. This design decisions created a special case that adds
unnecessary complexity and prevents the Point class from being
immutable.

From this point on, the position of a node is solely managed through
using the position() and moveTo(...) methods on Node.
prmr added a commit that referenced this issue Apr 29, 2021
@prmr prmr closed this as completed Apr 30, 2021
louib pushed a commit to louib/JetUML that referenced this issue Aug 15, 2021
The x and y values for the position of a node are no longer managed as
node properties. This design decisions created a special case that adds
unnecessary complexity and prevents the Point class from being
immutable.

From this point on, the position of a node is solely managed through
using the position() and moveTo(...) methods on Node.
louib pushed a commit to louib/JetUML that referenced this issue Aug 15, 2021
louib pushed a commit to louib/JetUML that referenced this issue Aug 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
main Issues with the main code base refactoring A proposal to refector or generally improve the code
Projects
None yet
Development

No branches or pull requests

1 participant