Skip to content

Commit

Permalink
perf: Add DispatchNativePositionChange export
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed Jun 1, 2023
1 parent 06f31f2 commit f178115
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ partial void DetachVisualPartial()
#endif
}

#if NET7_0_OR_GREATER
[JSExport]
#endif
public static int DispatchNativePositionChange(int focusVisualId)
{
var element = UIElement.GetElementFromHandle(focusVisualId) as SystemFocusVisual;
Expand Down
8 changes: 6 additions & 2 deletions src/Uno.UI/ts/Windows/UI/Xaml/Input/FocusVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@

private static onDocumentScroll() {
if (!FocusVisual.dispatchPositionChange) {
FocusVisual.dispatchPositionChange = (<any>Module).mono_bind_static_method(
"[Uno.UI] Uno.UI.Xaml.Controls.SystemFocusVisual:DispatchNativePositionChange");
if ((<any>globalThis).DotnetExports !== undefined) {
FocusVisual.dispatchPositionChange = (<any>globalThis).DotnetExports.UnoUI.Uno.UI.Xaml.Controls.SystemFocusVisual.DispatchNativePositionChange;
} else {
FocusVisual.dispatchPositionChange = (<any>Module).mono_bind_static_method(
"[Uno.UI] Uno.UI.Xaml.Controls.SystemFocusVisual:DispatchNativePositionChange");
}
}

FocusVisual.updatePosition();
Expand Down

0 comments on commit f178115

Please sign in to comment.