From b0621dcd05d9f9ce7f64412438c12bb2c55d43d9 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Sun, 14 Jul 2024 15:38:34 -0400 Subject: [PATCH] Fix scrolling by adding missing `NSEventPhaseEnded` check --- platform/macos/godot_content_view.mm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/macos/godot_content_view.mm b/platform/macos/godot_content_view.mm index 7d43ac9fe618..0e758248d4e5 100644 --- a/platform/macos/godot_content_view.mm +++ b/platform/macos/godot_content_view.mm @@ -802,23 +802,23 @@ - (void)scrollWheel:(NSEvent *)event { delta_y *= 0.03; } - if ([event momentumPhase] != NSEventPhaseNone) { - if (ignore_momentum_scroll) { - return; - } - } else { + if ([event momentumPhase] == NSEventPhaseNone || [event momentumPhase] == NSEventPhaseEnded) { ignore_momentum_scroll = false; + } else if (ignore_momentum_scroll) { + return; } - if ([event phase] != NSEventPhaseNone || [event momentumPhase] != NSEventPhaseNone) { - [self processPanEvent:event dx:delta_x dy:delta_y]; - } else { + if ( + ([event phase] == NSEventPhaseNone || [event phase] == NSEventPhaseEnded) || + ([event momentumPhase] == NSEventPhaseNone || [event momentumPhase] == NSEventPhaseEnded)) { if (fabs(delta_x)) { [self processScrollEvent:event button:(0 > delta_x ? MouseButton::WHEEL_RIGHT : MouseButton::WHEEL_LEFT) factor:fabs(delta_x * 0.3)]; } if (fabs(delta_y)) { [self processScrollEvent:event button:(0 < delta_y ? MouseButton::WHEEL_UP : MouseButton::WHEEL_DOWN) factor:fabs(delta_y * 0.3)]; } + } else { + [self processPanEvent:event dx:delta_x dy:delta_y]; } }