diff --git a/VL.CEF/help/Explanation Overview Skia.vl b/VL.CEF/help/Explanation Overview Skia.vl index 78371dc..bf5348e 100644 --- a/VL.CEF/help/Explanation Overview Skia.vl +++ b/VL.CEF/help/Explanation Overview Skia.vl @@ -1,8 +1,243 @@  - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bang + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Press + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9 + Comment + + + + + + + + 9 + Comment + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -94,12 +1014,32 @@ - - + + + + + + + + + + + + + + + + + + + + + - + + \ No newline at end of file diff --git a/VL.CEF/src/WebBrowser.InputHandling.cs b/VL.CEF/src/WebBrowser.InputHandling.cs index ca6cc2d..3d5f2f7 100644 --- a/VL.CEF/src/WebBrowser.InputHandling.cs +++ b/VL.CEF/src/WebBrowser.InputHandling.cs @@ -1,6 +1,7 @@ using Stride.Core.Mathematics; using System; using System.Diagnostics; +using VL.Core; using VL.Lib.IO; using VL.Lib.IO.Notifications; using Xilium.CefGlue; @@ -11,11 +12,24 @@ partial class WebBrowser { CefEventFlags mouseModifiers; - public bool SendNotification(INotification notification) + class Transformer : INotificationSpaceTransformer + { + public Vector2 TransformPosition(Vector2 point) + { + throw new NotImplementedException(); + } + + public Vector2 TransformSize(Vector2 size) + { + throw new NotImplementedException(); + } + } + + public bool SendNotification(INotification notification, RectangleF bounds) { if (notification is MouseNotification mouseNotification) { - HandleMouseNotification(mouseNotification); + HandleMouseNotification(mouseNotification, bounds); return true; } else if (notification is KeyNotification keyNotification) @@ -25,15 +39,15 @@ public bool SendNotification(INotification notification) } else if (notification is TouchNotification touchNotification) { - HandleTouchNotification(touchNotification); + HandleTouchNotification(touchNotification, bounds); return true; } return false; } - private void HandleTouchNotification(TouchNotification n) + private void HandleTouchNotification(TouchNotification n, RectangleF bounds) { - var position = n.Position.DeviceToLogical(ScaleFactor); + var position = GetPositionInBrowserSpace(n, bounds); var touchEvent = new CefTouchEvent() { Id = n.Id, @@ -104,7 +118,7 @@ private void HandleKeyNotification(KeyNotification n) Vector2 lastPosition; Stopwatch stopwatch = Stopwatch.StartNew(); - private void HandleMouseNotification(MouseNotification n) + private void HandleMouseNotification(MouseNotification n, RectangleF bounds) { if (n is MouseButtonNotification buttonNotification) { @@ -142,7 +156,7 @@ private void HandleMouseNotification(MouseNotification n) } { - var position = n.Position.DeviceToLogical(ScaleFactor); + var position = GetPositionInBrowserSpace(n, bounds); var mouseEvent = new CefMouseEvent((int)position.X, (int)position.Y, GetModifiers(n)); var browserHost = BrowserHost; switch (n.Kind) @@ -209,5 +223,14 @@ CefEventFlags GetModifiers(NotificationBase n) result |= CefEventFlags.ControlDown | CefEventFlags.IsLeft; return result | mouseModifiers; } + + Vector2 GetPositionInBrowserSpace(INotificationWithSpacePositions notification, RectangleF ourBounds) + { + var ourPosition = ourBounds.Center; + var ourSize = ourBounds.Size.ToVector2(); + //var t = Matrix.Transformation2D(default, 0, ourSize, default, 0, ourPosition); + //Vector2.TransformCoordinate() + return VLMath.Map(notification.PositionInWorldSpace, ourBounds.TopLeft, ourBounds.BottomRight, default, Size, MapMode.Float).DeviceToLogical(ScaleFactor); + } } }