Skip to content

Commit

Permalink
Fixed an issue causing overly wide diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
arnab-sen committed Dec 7, 2020
1 parent e971cd3 commit c3d3597
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 6 additions & 4 deletions ALACore/DomainAbstractions/RightTreeLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class RightTreeLayout<T> : IDataFlow<T>, IEvent

// Configurations


// Required - returns the ID of the node render, and is used for cycle detection
public Func<T, string> GetID { get; set; }

Expand Down Expand Up @@ -52,12 +53,13 @@ public class RightTreeLayout<T> : IDataFlow<T>, IEvent
public Func<HashSet<string>> GetRoots { get; set; }

// Outputs for future runs
public double LatestX => _latestX;


// Only the latest y-coordinate needs to be known globally
public double LatestY => _latestY;

// Private fields
private HashSet<string> _visited = new HashSet<string>();
private double _latestX = 0;
private double _latestY = 0;

// Ports
Expand Down Expand Up @@ -120,12 +122,12 @@ private double SetRightTreeLayout(T node, double horizontalGap, double verticalG
}
else
{
_latestX = x + GetWidth(node) + horizontalGap;
var latestX = x + GetWidth(node) + horizontalGap;
_latestY = y;

foreach (var child in children)
{
if (!_visited.Contains(GetID(child))) _latestY = SetRightTreeLayout(child, horizontalGap, verticalGap, _latestX, _latestY);
if (!_visited.Contains(GetID(child))) _latestY = SetRightTreeLayout(child, horizontalGap, verticalGap, latestX, _latestY);
}
}

Expand Down
2 changes: 1 addition & 1 deletion GALADE_Standalone/Application/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public bool ChangeSetting(string name, string value)

private void CreateWiring()
{
var VERSION_NUMBER = "1.2.0";
var VERSION_NUMBER = "1.2.1";

#region Set up directory and file paths
string APP_DIRECTORY = Utilities.GetApplicationDirectory();
Expand Down
7 changes: 5 additions & 2 deletions TestApp/Application/ExampleApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ public ExampleDomainAbstraction(string arg0, string arg2 = "test")
{
// BEGIN AUTO-GENERATED INSTANTIATIONS FOR test
var _0 = new Apply<string, string>() {InstanceName="_0"};
var id_fad4f4191b7344a09854e4d3cd7a1e43 = new Button() {};
var root0 = new Apply<T1, T2>() {};
// END AUTO-GENERATED INSTANTIATIONS FOR test

// BEGIN AUTO-GENERATED WIRING FOR test
root0.WireTo(_0, "output");
_0.WireTo(id_fad4f4191b7344a09854e4d3cd7a1e43, "output");
// END AUTO-GENERATED WIRING FOR test

}
Expand Down Expand Up @@ -75,6 +74,10 @@ public ExampleDomainAbstraction(string arg0, string arg2 = "test")










Expand Down

0 comments on commit c3d3597

Please sign in to comment.