Add switcher
This commit is contained in:
@@ -16,6 +16,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public ISet<IEdge> Inputs { get; init; }
|
||||
public ISet<IEdge> Outputs { get; init; }
|
||||
|
||||
public bool IsClickable { get; private set; }
|
||||
public bool IsActive => CallbackActive();
|
||||
public bool IsAnimationActive {
|
||||
get => _animationActive;
|
||||
@@ -33,12 +34,13 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
private Auger? _auger;
|
||||
private TextBlock? _text;
|
||||
|
||||
public EncasedAuger(string label, double x, double y, Func<bool> cbActive, double angle = 0) {
|
||||
public EncasedAuger(string label, double x, double y, Func<bool> cbActive, double angle = 0, bool clickable = true) {
|
||||
CenterX = x;
|
||||
CenterY = y;
|
||||
Label = label;
|
||||
Angle = angle;
|
||||
CallbackActive = cbActive;
|
||||
IsClickable = clickable;
|
||||
Inputs = new HashSet<IEdge>();
|
||||
Outputs = new HashSet<IEdge>();
|
||||
}
|
||||
@@ -84,6 +86,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Update(bool isHovering, bool isPressed) {
|
||||
isHovering = isHovering && IsClickable;
|
||||
IsAnimationActive = IsActive;
|
||||
_inner?.Fill =
|
||||
IsAnimationActive && isHovering && isPressed ? PamhagenBrushes.Red :
|
||||
|
||||
Reference in New Issue
Block a user