Add clearance logic to PamhagenPlant
This commit is contained in:
@@ -17,10 +17,11 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public ISet<IEdge> Inputs { get; init; }
|
||||
public ISet<IEdge> Outputs { get; init; }
|
||||
|
||||
public bool IsActive {
|
||||
get => _active;
|
||||
public bool IsActive => CallbackActive();
|
||||
public bool IsAnimationActive {
|
||||
get => _animationActive;
|
||||
set {
|
||||
_active = value;
|
||||
_animationActive = value;
|
||||
if (value) {
|
||||
_storyboard?.Resume();
|
||||
} else {
|
||||
@@ -29,15 +30,18 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
private bool _active;
|
||||
protected Func<bool> CallbackActive;
|
||||
|
||||
private bool _animationActive;
|
||||
private Shape? _rect;
|
||||
private Polyline? _polyline;
|
||||
private Storyboard? _storyboard;
|
||||
|
||||
public ConveyorBelt(string label, double x, double y) {
|
||||
public ConveyorBelt(string label, double x, double y, Func<bool> cbActive) {
|
||||
CenterX = x;
|
||||
CenterY = y;
|
||||
Label = label;
|
||||
CallbackActive = cbActive;
|
||||
Inputs = new HashSet<IEdge>();
|
||||
Outputs = new HashSet<IEdge>();
|
||||
}
|
||||
@@ -97,12 +101,13 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Update(bool isHovering, bool isPressed) {
|
||||
IsAnimationActive = IsActive;
|
||||
_rect?.Fill =
|
||||
IsActive && isHovering && isPressed ? PamhagenBrushes.Red :
|
||||
IsActive && isHovering ? PamhagenBrushes.Red :
|
||||
!IsActive && isHovering && isPressed ? PamhagenBrushes.Green :
|
||||
!IsActive && isHovering ? PamhagenBrushes.Green :
|
||||
IsActive ? PamhagenBrushes.Green :
|
||||
IsAnimationActive && isHovering && isPressed ? PamhagenBrushes.Red :
|
||||
IsAnimationActive && isHovering ? PamhagenBrushes.Red :
|
||||
!IsAnimationActive && isHovering && isPressed ? PamhagenBrushes.Green :
|
||||
!IsAnimationActive && isHovering ? PamhagenBrushes.Green :
|
||||
IsAnimationActive ? PamhagenBrushes.Green :
|
||||
Brushes.WhiteSmoke;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user