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

[Zest 2.0] Ignore node size when calculating position in layout #570

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

ptziegler
Copy link
Contributor

@ptziegler ptziegler commented Sep 27, 2024

The location of a node describes its top-left pixel, rather than its center. When using layout algorithms that are based on the grid layout, this causes the offset to be half the space between the rows and columns plus the half the width and height of the nodes.
Latter is undesirable and may cause nodes to be partially moved outside the client area.

The same issue can be observed in the other layout algorithms (Spring/Tree/Radial) when fitting the nodes into the client area, because the same mistake is repeated in the AlgorithmHelper class.

@ptziegler ptziegler added this to the 3.22.0 milestone Sep 27, 2024
@ptziegler
Copy link
Contributor Author

I noticed this while migrating the Zest layout example. This is what the layout currently looks like:

image

Even though it's supposed to look like:

image

The location of a node describes its top-left pixel, rather than its
center. When using layout algorithms that are based on the grid layout,
this causes the offset to be half the space between the rows and columns
plus the half the width and height of the nodes.
Latter is undesirable and may cause nodes to be partially moved outside
the client area.

The same issue can be observed in the other layout algorithms
(Spring/Tree/Radial) when fitting the nodes into the client area,
because the same mistake is repeated in the AlgorithmHelper class.
@ptziegler ptziegler changed the title [Zest 2.0] Ignore node size when calculating position in grid [Zest 2.0] Ignore node size when calculating position in layout Sep 27, 2024
@azoitl azoitl merged commit 9bd2cb9 into eclipse-gef:master Sep 28, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants