@ -11,7 +11,7 @@ namespace Avalonia.iOS;
[UnsupportedOSPlatform("tvos")]
[UnsupportedOSPlatform("tvos")]
[SupportedOSPlatform("maccatalyst")]
[SupportedOSPlatform("maccatalyst")]
[SupportedOSPlatform("ios")]
[SupportedOSPlatform("ios")]
internal sealed class UIKitInputPane : II nputPane
internal sealed class UIKitInputPane : InputPaneBas e
{
{
public static UIKitInputPane Instance { get ; } = new ( ) ;
public static UIKitInputPane Instance { get ; } = new ( ) ;
@ -24,11 +24,7 @@ internal sealed class UIKitInputPane : IInputPane
. DefaultCenter
. DefaultCenter
. AddObserver ( UIKeyboard . WillHideNotification , KeyboardDownNotification ) ;
. AddObserver ( UIKeyboard . WillHideNotification , KeyboardDownNotification ) ;
}
}
public InputPaneState State { get ; private set ; }
public Rect OccludedRect { get ; private set ; }
public event EventHandler < InputPaneStateEventArgs > ? StateChanged ;
private void KeyboardDownNotification ( NSNotification obj ) = > RaiseEventFromNotification ( false , obj ) ;
private void KeyboardDownNotification ( NSNotification obj ) = > RaiseEventFromNotification ( false , obj ) ;
private void KeyboardUpNotification ( NSNotification obj ) = > RaiseEventFromNotification ( true , obj ) ;
private void KeyboardUpNotification ( NSNotification obj ) = > RaiseEventFromNotification ( true , obj ) ;
@ -38,7 +34,7 @@ internal sealed class UIKitInputPane : IInputPane
State = isUp ? InputPaneState . Open : InputPaneState . Closed ;
State = isUp ? InputPaneState . Open : InputPaneState . Closed ;
#if MACCATALYST
#if MACCATALYST
OccludedRect = default ;
OccludedRect = default ;
StateChanged ? . Invoke ( this , new InputPaneStateEventArgs (
On StateChanged( new InputPaneStateEventArgs (
State , null , OccludedRect ) ) ;
State , null , OccludedRect ) ) ;
#else
#else
var startFrame = UIKeyboard . FrameBeginFromNotification ( notification ) ;
var startFrame = UIKeyboard . FrameBeginFromNotification ( notification ) ;
@ -55,7 +51,7 @@ internal sealed class UIKitInputPane : IInputPane
var startRect = new Rect ( startFrame . X , startFrame . Y , startFrame . Width , startFrame . Height ) ;
var startRect = new Rect ( startFrame . X , startFrame . Y , startFrame . Width , startFrame . Height ) ;
OccludedRect = new Rect ( endFrame . X , endFrame . Y , endFrame . Width , endFrame . Height ) ;
OccludedRect = new Rect ( endFrame . X , endFrame . Y , endFrame . Width , endFrame . Height ) ;
StateChanged ? . Invoke ( this , new InputPaneStateEventArgs (
On StateChanged( new InputPaneStateEventArgs (
State , startRect , OccludedRect , TimeSpan . FromSeconds ( duration ) , easing ) ) ;
State , startRect , OccludedRect , TimeSpan . FromSeconds ( duration ) , easing ) ) ;
#endif
#endif
}
}