public static IObservable <bool> IsHovering(this Hittable control) { return(Observable .Merge( control.Entered.Select(_ => true), control.Exited.Select(_ => false)) .StartWith(false)); }
public static IObservable <bool> IsPressed(this Hittable control) { return(Observable .Merge( control.Pressed.Select(_ => true), control.Released.Select(_ => false), control.LostFocus.Select(_ => false)) .StartWith(false)); }
public static Hittable OnMouse( this Hittable hittable, Optional <Command> pressed = default(Optional <Command>), Optional <Command> released = default(Optional <Command>), Optional <Command> doubleClicked = default(Optional <Command>), Optional <Command> entered = default(Optional <Command>), Optional <Command> exited = default(Optional <Command>)) { ExecCommandWhileRooted(hittable.Pressed, pressed, hittable.Control); ExecCommandWhileRooted(hittable.Released, released, hittable.Control); ExecCommandWhileRooted(hittable.DoubleClicked, doubleClicked, hittable.Control); ExecCommandWhileRooted(hittable.Entered, entered, hittable.Control); ExecCommandWhileRooted(hittable.Exited, exited, hittable.Control); return(hittable); }