Fix hovering with IsMouseOver
Test / Run tests (push) Successful in 16s

This commit is contained in:
lorenz.stechauner committed 2026-11-06 14:17:34 +01:00
1 parent eaafc47804
commit f784f7871a
2 files changed
+7 -2

No files matched your search

@@ -163,6 +163,10 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
Graph.SetPos(s, cx - w / 2, cy - h / 2, scale); Graph.SetPos(s, cx - w / 2, cy - h / 2, scale);
} }
public ISet<INode> GetHover(Point? p, double scale) {
return p is Point v ? GetHover(v.X, v.Y, scale) : new HashSet<INode>();
}
public ISet<INode> GetHover(double x, double y, double scale) { public ISet<INode> GetHover(double x, double y, double scale) {
return Nodes.Where(n => n.IsInside(x / scale, y / scale)).ToHashSet(); return Nodes.Where(n => n.IsInside(x / scale, y / scale)).ToHashSet();
} }
@@ -489,7 +489,8 @@ namespace PamhagenSysCtrl.Windows {
e.Pump.IsActive || Graph.GetFreePath([e.Source, e.Sink], overrideStart: true) == null); e.Pump.IsActive || Graph.GetFreePath([e.Source, e.Sink], overrideStart: true) == null);
} }
private ISet<INode> UpdateScheme(Point pos, bool down) { private ISet<INode> UpdateScheme(Point? pos, bool down) {
if (!SchemeCanvas.IsMouseOver) pos = null;
foreach (var e in Graph.Edges) { foreach (var e in Graph.Edges) {
e.Highlight = null; e.Highlight = null;
e.Flow = 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_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); 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(); var hoverButtons = FastSelectPaths.Where(b => b.Key.IsMouseOver).ToDictionary();
Path? hoverPathDeactivate = null; Path? hoverPathDeactivate = null;
if (App.Plant?.ManualControlMode ?? false) { if (App.Plant?.ManualControlMode ?? false) {