Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 15defc4

Browse files
committed
Issue #2 - Nodes on right side of graph aren't centered : #2
Thanks @sambonfire
1 parent 3bb54e8 commit 15defc4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: Editor/DependencyGraph.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ private void CenterTreeToRoot(DependencyViewerNode.NodeInputSide side)
192192

193193
if (children.Count > 1)
194194
{
195-
float distanceBetweenFirstAndLast = _refTargetNode.GetLastChild(side).Position.y - _refTargetNode.GetFirstChild(side).Position.y;
195+
float size = _refTargetNode.GetLastChild(side).Position.y - _refTargetNode.GetFirstChild(side).Position.y;
196196
float actualY = _refTargetNode.GetFirstChild(side).Position.y;
197-
float desiredY = -distanceBetweenFirstAndLast / 2;
197+
float desiredY = _refTargetNode.Position.y - size / 2.0f;
198198
float shiftY = desiredY - actualY;
199-
199+
200200
for (int i = 0; i < children.Count; ++i)
201201
{
202202
children[i].ForeachChildrenRecursively(side, (node) => node.SetPositionY(node.Position.y + shiftY));

0 commit comments

Comments
 (0)