提交 6fc79f11 编写于 作者: E Elie Bariche

perf(WindowManager): Add SetPointerCapture binding

上级 bf0276dd
......@@ -343,8 +343,7 @@ public partial class UIElement : DependencyObject
#region Capture
partial void CapturePointerNative(Pointer pointer)
{
var command = "Uno.UI.WindowManager.current.setPointerCapture(" + HtmlId + ", " + pointer.PointerId + ");";
WebAssemblyRuntime.InvokeJS(command);
WindowManagerInterop.SetPointerCapture(HtmlId, pointer.PointerId);
}
partial void ReleasePointerNative(Pointer pointer)
......
......@@ -192,6 +192,16 @@ namespace Uno.UI.Xaml
#endregion
internal static void SetPointerCapture(IntPtr htmlId, uint pointerId)
{
#if NET7_0_OR_GREATER
NativeMethods.SetPointerCapture(htmlId, pointerId);
#else
var command = "Uno.UI.WindowManager.current.setPointerCapture(" + htmlId + ", " + pointerId + ");";
WebAssemblyRuntime.InvokeJS(command);
#endif
}
#region MeasureView
internal static Size MeasureView(IntPtr htmlId, Size availableSize, bool measureContent)
{
......@@ -1216,6 +1226,9 @@ namespace Uno.UI.Xaml
[JSImport("globalThis.Uno.UI.WindowManager.current.setElementTransformNativeFast")]
internal static partial void SetElementTransform(IntPtr htmlId, float m11, float m12, float m21, float m22, float m31, float m32);
[JSImport("globalThis.Uno.UI.WindowManager.current.setPointerCapture")]
internal static partial void SetPointerCapture(IntPtr htmlId, double pointerId);
[JSImport("globalThis.Uno.UI.WindowManager.current.setPointerEventsNativeFast")]
internal static partial void SetPointerEvents(IntPtr htmlId, bool enabled);
......
......@@ -1474,10 +1474,8 @@ namespace Uno.UI {
}
}
public setPointerCapture(viewId: number, pointerId: number): string {
public setPointerCapture(viewId: number, pointerId: number): void {
this.getView(viewId).setPointerCapture(pointerId);
return "ok";
}
public releasePointerCapture(viewId: number, pointerId: number): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册