From 92fa6f8a6d3688633ae142c1482918d9eeaec9bd Mon Sep 17 00:00:00 2001 From: Nicolas Cellier Date: Fri, 27 Dec 2019 18:33:39 +0100 Subject: [PATCH] OSX: accumulate enough delta before sending the wheel event to the image --- .../vm/OSX/sqSqueakOSXApplication+events.m | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m index 8c9cd6f692..28808b9502 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m @@ -263,11 +263,15 @@ - (void) recordMouseEvent:(NSEvent *)theEvent fromView: (NSView *) aView{ [self recordMouseEvent: theEvent fromView: aView]; + static float prevXDelta = 0; + static float prevYDelta = 0; + static int prevXTime = 0; + static int prevYTime = 0; #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7) CGFloat x = [theEvent scrollingDeltaX]; CGFloat y = [theEvent scrollingDeltaY]; - int xDelta = x * 120; - int yDelta = y * 120; + float xDelta = x * 120; + float yDelta = y * 120; if ([theEvent respondsToSelector:@selector(hasPreciseScrollingDeltas)]) { if ([theEvent hasPreciseScrollingDeltas]) { xDelta = x; @@ -277,21 +281,33 @@ - (void) recordWheelEvent:(NSEvent *) theEvent fromView: (NSView