接続数を整列に加味

This commit is contained in:
naninunenoy 2020-11-26 23:25:03 +09:00
parent ad5ad99975
commit 5e63d32268

View File

@ -44,6 +44,15 @@ namespace AsmdefHelper.DependencyGraph.Editor.DependencyNode.Sort {
} }
} }
// 接続数に応じて左右に移動させる
// ref to が多いものが左に、ref by が多いものが右に
const float factor = 60.0F;
foreach (var dep in nodeArr) {
var score = (dep.Sources.Count - dep.Destinations.Count) * factor;
var p = posDict[dep.Profile];
posDict[dep.Profile] = new Vector2(p.x + score, p.y);
}
return posDict.Select(x => new SortedNode { Profile = x.Key, Position = x.Value }); return posDict.Select(x => new SortedNode { Profile = x.Key, Position = x.Value });
} }
} }