1+ using System . Runtime . CompilerServices ;
12using Ivy . Core ;
23
34// ReSharper disable once CheckNamespace
@@ -27,6 +28,8 @@ internal CameraInput() { }
2728 [ Event ] public EventHandler < Event < IAnyInput > > ? OnBlur { get ; set ; }
2829 [ Event ] public EventHandler < Event < IAnyInput > > ? OnFocus { get ; set ; }
2930
31+ [ Prop ] public bool AutoFocus { get ; set ; }
32+
3033 public Type [ ] SupportedStateTypes ( ) => [ ] ;
3134}
3235
@@ -40,4 +43,27 @@ public static CameraInput Disabled(this CameraInput widget, bool disabled = true
4043
4144 public static CameraInput FacingMode ( this CameraInput widget , string facingMode )
4245 => widget with { FacingMode = facingMode } ;
46+
47+ public static CameraInput AutoFocus ( this CameraInput widget , bool autoFocus = true )
48+ => widget with { AutoFocus = autoFocus } ;
49+
50+ [ OverloadResolutionPriority ( 1 ) ]
51+ public static CameraInput OnBlur ( this CameraInput widget , Func < Event < IAnyInput > , ValueTask > onBlur )
52+ => widget with { OnBlur = new ( onBlur ) } ;
53+
54+ public static CameraInput OnBlur ( this CameraInput widget , Action < Event < IAnyInput > > onBlur )
55+ => widget with { OnBlur = new ( onBlur . ToValueTask ( ) ) } ;
56+
57+ public static CameraInput OnBlur ( this CameraInput widget , Action onBlur )
58+ => widget with { OnBlur = new ( _ => { onBlur ( ) ; return ValueTask . CompletedTask ; } ) } ;
59+
60+ [ OverloadResolutionPriority ( 1 ) ]
61+ public static CameraInput OnFocus ( this CameraInput widget , Func < Event < IAnyInput > , ValueTask > onFocus )
62+ => widget with { OnFocus = new ( onFocus ) } ;
63+
64+ public static CameraInput OnFocus ( this CameraInput widget , Action < Event < IAnyInput > > onFocus )
65+ => widget with { OnFocus = new ( onFocus . ToValueTask ( ) ) } ;
66+
67+ public static CameraInput OnFocus ( this CameraInput widget , Action onFocus )
68+ => widget with { OnFocus = new ( _ => { onFocus ( ) ; return ValueTask . CompletedTask ; } ) } ;
4369}
0 commit comments