From fcf79c45eba904a966c9abd11ebaaf37bf74ce4d Mon Sep 17 00:00:00 2001 From: donandren Date: Sat, 5 Dec 2015 17:36:17 +0200 Subject: [PATCH] enhanced emulation of mouse scroll event from touch in iOS --- src/iOS/Perspex.iOS/PerspexView.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/iOS/Perspex.iOS/PerspexView.cs b/src/iOS/Perspex.iOS/PerspexView.cs index 43d941fba3..4adfb98790 100644 --- a/src/iOS/Perspex.iOS/PerspexView.cs +++ b/src/iOS/Perspex.iOS/PerspexView.cs @@ -168,8 +168,14 @@ namespace Perspex.iOS RawMouseEventType.Move, location, InputModifiers.LeftMouseButton)); else { - Input?.Invoke(new RawMouseWheelEventArgs(PerspexAppDelegate.MouseDevice, (uint) touch.Timestamp, - _inputRoot, location, location - _touchLastPoint, InputModifiers.LeftMouseButton)); + double x = location.X - _touchLastPoint.X; + double y = location.Y - _touchLastPoint.Y; + double correction = 0.02; + var scale = PerspexLocator.Current.GetService().RenderScalingFactor; + scale = 1; + + Input?.Invoke(new RawMouseWheelEventArgs(PerspexAppDelegate.MouseDevice, (uint)touch.Timestamp, + _inputRoot, location, new Vector(x * correction / scale, y * correction / scale), InputModifiers.LeftMouseButton)); } _touchLastPoint = location; }