Skip to content

Commit

Permalink
perf(CoreWindow): Add SetCursor binding
Browse files Browse the repository at this point in the history
  • Loading branch information
ebariche committed May 23, 2023
1 parent 13d39e9 commit c3ee894
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Uno.UWP/UI/Core/CoreWindow.Interop.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ internal partial class CoreWindow
{
internal static partial class NativeMethods
{
[JSImport("globalThis.Uno.UI.WindowManager.current.setCursor")]
internal static partial void SetCursor(string type);
}
}
}
#endif
#endif
4 changes: 4 additions & 0 deletions src/Uno.UWP/UI/Core/CoreWindow.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public partial class CoreWindow

private void Internal_SetPointerCursor()
{
#if NET7_0_OR_GREATER
NativeMethods.SetCursor(_pointerCursor.Type.ToCssCursor());
#else
var command = string.Concat(new[]
{
"Uno.UI.WindowManager.current.setCursor(\"",
Expand All @@ -31,6 +34,7 @@ private void Internal_SetPointerCursor()
});

WebAssemblyRuntime.InvokeJS(command);
#endif
}
}
}

0 comments on commit c3ee894

Please sign in to comment.