From c37f055b56ce1a4d195ceb49602bea06ce1d65d2 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 23 Jul 2018 21:20:17 +0100 Subject: [PATCH] cache mouse position. --- src/Avalonia.Windowing/WindowImpl.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Windowing/WindowImpl.cs b/src/Avalonia.Windowing/WindowImpl.cs index a5801f4fc3..eb6a695fca 100644 --- a/src/Avalonia.Windowing/WindowImpl.cs +++ b/src/Avalonia.Windowing/WindowImpl.cs @@ -13,6 +13,7 @@ namespace Avalonia.Windowing public class Window : IWindowImpl { IWindowWrapper _windowWrapper; + private LogicalPosition _lastPosition; public Window(IWindowWrapper wrapper) { @@ -169,7 +170,13 @@ namespace Avalonia.Windowing public void OnMouseEvent(MouseEvent evt) { Dispatcher.UIThread.RunJobs(DispatcherPriority.Input); - Input(new RawMouseEventArgs(MouseDevice, (uint)Environment.TickCount, _inputRoot, (RawMouseEventType)evt.EventType, new Point(evt.Position.X, evt.Position.Y), InputModifiers.None)); + + if(evt.EventType == MouseEventType.Move) + { + _lastPosition = evt.Position; + } + + Input(new RawMouseEventArgs(MouseDevice, (uint)Environment.TickCount, _inputRoot, (RawMouseEventType)evt.EventType, new Point(_lastPosition.X, _lastPosition.Y), InputModifiers.None)); } public void OnResizeEvent(ResizeEvent evt)