diff --git a/src/Uno.UI/UI/Xaml/UIElement.Pointers.wasm.cs b/src/Uno.UI/UI/Xaml/UIElement.Pointers.wasm.cs index 95d8ba727157..af229b4beee7 100644 --- a/src/Uno.UI/UI/Xaml/UIElement.Pointers.wasm.cs +++ b/src/Uno.UI/UI/Xaml/UIElement.Pointers.wasm.cs @@ -348,8 +348,7 @@ partial void CapturePointerNative(Pointer pointer) partial void ReleasePointerNative(Pointer pointer) { - var command = "Uno.UI.WindowManager.current.releasePointerCapture(" + HtmlId + ", " + pointer.PointerId + ");"; - WebAssemblyRuntime.InvokeJS(command); + WindowManagerInterop.ReleasePointerCapture(HtmlId, pointer.PointerId); } #endregion diff --git a/src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs b/src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs index db7d742294ed..fe773c39873d 100644 --- a/src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs +++ b/src/Uno.UI/UI/Xaml/WindowManagerInterop.wasm.cs @@ -202,6 +202,16 @@ internal static void SetPointerCapture(IntPtr htmlId, uint pointerId) #endif } + internal static void ReleasePointerCapture(IntPtr htmlId, uint pointerId) + { +#if NET7_0_OR_GREATER + NativeMethods.ReleasePointerCapture(htmlId, pointerId); +#else + var command = "Uno.UI.WindowManager.current.releasePointerCapture(" + htmlId + ", " + pointerId + ");"; + WebAssemblyRuntime.InvokeJS(command); +#endif + } + #region MeasureView internal static Size MeasureView(IntPtr htmlId, Size availableSize, bool measureContent) { @@ -1220,6 +1230,9 @@ internal static partial void ArrangeElement( [JSImport("globalThis.Uno.UI.WindowManager.current.measureViewNativeFast")] internal static partial void MeasureView(IntPtr htmlId, double availableWidth, double availableHeight, bool measureContent, IntPtr pReturn); + [JSImport("globalThis.Uno.UI.WindowManager.current.releasePointerCapture")] + internal static partial void ReleasePointerCapture(IntPtr htmlId, double pointerId); + [JSImport("globalThis.Uno.UI.WindowManager.current.setAttributesNativeFast")] internal static partial void SetAttributes(IntPtr htmlId, string[] pairs); diff --git a/src/Uno.UI/ts/WindowManager.ts b/src/Uno.UI/ts/WindowManager.ts index f52d0238097c..553f5681f72a 100644 --- a/src/Uno.UI/ts/WindowManager.ts +++ b/src/Uno.UI/ts/WindowManager.ts @@ -1478,10 +1478,8 @@ namespace Uno.UI { this.getView(viewId).setPointerCapture(pointerId); } - public releasePointerCapture(viewId: number, pointerId: number): string { + public releasePointerCapture(viewId: number, pointerId: number): void { this.getView(viewId).releasePointerCapture(pointerId); - - return "ok"; } public focusView(elementId: number): string {