Add clearance logic to PamhagenPlant
This commit is contained in:
@@ -16,25 +16,29 @@ 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;
|
||||
_auger?.IsActive = value;
|
||||
_animationActive = value;
|
||||
_auger?.IsAnimationActive = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _active;
|
||||
protected Func<bool> CallbackActive;
|
||||
|
||||
private bool _animationActive;
|
||||
private Shape? _inner;
|
||||
private Shape? _outer;
|
||||
private Auger? _auger;
|
||||
private TextBlock? _text;
|
||||
|
||||
public EncasedAuger(string label, double x, double y, double angle = 0) {
|
||||
public EncasedAuger(string label, double x, double y, Func<bool> cbActive, double angle = 0) {
|
||||
CenterX = x;
|
||||
CenterY = y;
|
||||
Label = label;
|
||||
Angle = angle;
|
||||
CallbackActive = cbActive;
|
||||
Inputs = new HashSet<IEdge>();
|
||||
Outputs = new HashSet<IEdge>();
|
||||
}
|
||||
@@ -80,12 +84,13 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Update(bool isHovering, bool isPressed) {
|
||||
IsAnimationActive = IsActive;
|
||||
_inner?.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