diff --git a/PamhagenSysCtrl/Helpers/Pipeline/Graph.cs b/PamhagenSysCtrl/Helpers/Pipeline/Graph.cs index 136b275..bbade7f 100644 --- a/PamhagenSysCtrl/Helpers/Pipeline/Graph.cs +++ b/PamhagenSysCtrl/Helpers/Pipeline/Graph.cs @@ -163,6 +163,10 @@ namespace PamhagenSysCtrl.Helpers.Pipeline { Graph.SetPos(s, cx - w / 2, cy - h / 2, scale); } + public ISet GetHover(Point? p, double scale) { + return p is Point v ? GetHover(v.X, v.Y, scale) : new HashSet(); + } + public ISet GetHover(double x, double y, double scale) { return Nodes.Where(n => n.IsInside(x / scale, y / scale)).ToHashSet(); } diff --git a/PamhagenSysCtrl/Windows/PlantSchemeWindow.xaml.cs b/PamhagenSysCtrl/Windows/PlantSchemeWindow.xaml.cs index e0371b7..8b63752 100644 --- a/PamhagenSysCtrl/Windows/PlantSchemeWindow.xaml.cs +++ b/PamhagenSysCtrl/Windows/PlantSchemeWindow.xaml.cs @@ -489,7 +489,8 @@ namespace PamhagenSysCtrl.Windows { e.Pump.IsActive || Graph.GetFreePath([e.Source, e.Sink], overrideStart: true) == null); } - private ISet UpdateScheme(Point pos, bool down) { + private ISet UpdateScheme(Point? pos, bool down) { + if (!SchemeCanvas.IsMouseOver) pos = null; foreach (var e in Graph.Edges) { e.Highlight = null; e.Flow = null; @@ -509,7 +510,7 @@ namespace PamhagenSysCtrl.Windows { SetFastSelectButton(FastSelectButton_MP2_Forward, App.Plant?.State.MP2_State == MotorState.Forward ? 1 : 0, !(App.Plant?.State.MP2_HasClearance ?? false)); SetFastSelectButton(FastSelectButton_MP2_Stop, App.Plant?.State.MP2_State == MotorState.Halt ? 2 : 0); - _hover = Graph.GetHover(pos.X, pos.Y, RoundedScale); + _hover = Graph.GetHover(pos, RoundedScale); var hoverButtons = FastSelectPaths.Where(b => b.Key.IsMouseOver).ToDictionary(); Path? hoverPathDeactivate = null; if (App.Plant?.ManualControlMode ?? false) {