Thanks to visit codestin.com
Credit goes to github.com

Skip to content

updateDimensions in PreviewController does not take into account node size #514

@ripkrizbi

Description

@ripkrizbi

updateDimensions() in PreviewControllerImpl.java (Preview API) that is used to (re)calculate graph dimensions does so based on node centers, without considering node sizes, so the nodes on the border are cut off.

I would suggest adding a few lines to the loop over nodes: (PreviewControllerImpl.java line 192)

        for (Item nodeItem : nodeItems) {
            float x = (Float) nodeItem.getData("x");
            float y = (Float) nodeItem.getData("y");
            float s = (Float) nodeItem.getData("size");


            if (x-s < topLeftX) {
                topLeftX = x-s;
            }
            if (y-s < topLeftY) {
                topLeftY = y-s;
            }
            if (x+s > bottomRightX) {
                bottomRightX = x+s;
            }
            if (y+s > bottomRightY) {
                bottomRightY = y+s;
            }
        }

I can see that there is a "margin" property, but I can't find a way to set this property through the UI. One more issue is the correct calculation of graph boundaries when labels are rendered....

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions