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

Graph Editor: Reduce graph view auto layout spacing #1476

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/MaterialXGraphEditor/Graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ ImVec2 Graph::layoutPosition(UiNodePtr layoutNode, ImVec2 startingPos, bool init
UiNodePtr nextNode = layoutNode->getConnectedNode(pins[i]->_name);
if (nextNode)
{
startingPos.x = (1200.f - ((layoutNode->_level) * 350)) * _fontScale;
startingPos.x = (1200.f - ((layoutNode->_level) * 250)) * _fontScale;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has always been too widely spaced. Thanks for the fix.

As this is a hard-coded number still, I'm thinking it would be good to make this as display option data member on the Graph class, or at least a const somewhere. Then if needed the number can be adjusted in one obvious place.

It should handle high-dpi since it uses _fontScale can you do a quick check with different dpi settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a quick test with 175% on windows
image

vs 100%
image

ed::SetNodePosition(layoutNode->getId(), startingPos);
layoutNode->setPos(ImVec2(startingPos));
// call layout position on upstream node with newPos as -140 to the left of current node
Expand All @@ -581,7 +581,7 @@ ImVec2 Graph::layoutPosition(UiNodePtr layoutNode, ImVec2 startingPos, bool init
}
else
{
startingPos.x = (1200.f - ((layoutNode->_level) * 350)) * _fontScale;
startingPos.x = (1200.f - ((layoutNode->_level) * 250)) * _fontScale;
layoutNode->setPos(ImVec2(startingPos));
// set current node position
ed::SetNodePosition(layoutNode->getId(), ImVec2(startingPos));
Expand Down