Fix ColorSubgraph()
This commit is contained in:
@@ -64,7 +64,7 @@ namespace PamhagenSysCtrl.Windows {
|
||||
foreach (var (edge, node) in p.Hops) {
|
||||
edge.Highlight = Brushes.Green;
|
||||
if (node is Pump) c = Brushes.Orange;
|
||||
ColorSubgraph(node, c, (v) => v.IsLocked = true);
|
||||
Graph.ColorSubgraph(node, c, (v) => v.IsLocked = true);
|
||||
}
|
||||
}
|
||||
var hover = Graph.Update(pos.X, pos.Y, down);
|
||||
@@ -75,7 +75,7 @@ namespace PamhagenSysCtrl.Windows {
|
||||
foreach (var (edge, node) in path.Value.Hops) {
|
||||
edge.Highlight = Brushes.Green;
|
||||
if (node is Pump) c = Brushes.Orange;
|
||||
ColorSubgraph(node, c);
|
||||
Graph.ColorSubgraph(node, c);
|
||||
}
|
||||
}
|
||||
Graph.Update(pos.X, pos.Y, down);
|
||||
@@ -83,25 +83,6 @@ namespace PamhagenSysCtrl.Windows {
|
||||
return hover;
|
||||
}
|
||||
|
||||
private void ColorSubgraph(INode start, Brush color, Action<Valve>? valveAction = null) {
|
||||
if (start is Valve v) {
|
||||
valveAction?.Invoke(v);
|
||||
return;
|
||||
} else if (start is ISink || start is Pump) {
|
||||
return;
|
||||
}
|
||||
foreach (var edge in start.Inputs) {
|
||||
if (edge.Highlight != null) continue;
|
||||
edge.Highlight = color;
|
||||
ColorSubgraph(edge.Start, color, valveAction);
|
||||
}
|
||||
foreach (var edge in start.Outputs) {
|
||||
if (edge.Highlight != null) continue;
|
||||
edge.Highlight = color;
|
||||
ColorSubgraph(edge.End, color, valveAction);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnUpdate(object? sender, PlantEventArgs evt) {
|
||||
if (sender is not PamhagenPlant plant) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user