From fb1845f294dedc293f4d0852688b106ba24ec7f8 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 24 Nov 2023 08:19:59 -0500 Subject: [PATCH] Ladybird/AppKit: Invert the horizontal delta scroll value This matches the negation of the vertical scroll delta value. This makes the scroll events behave as follows on macOS: Natural scrolling enabled: * Scrolling up on the trackpad scrolls down on the page. * Scrolling right on the trackpad scrolls left on the page. Natural scrolling disabled: * Scrolling up on the trackpad scrolls up on the page. * Scrolling right on the trackpad scrolls right on the page. --- Ladybird/AppKit/UI/LadybirdWebView.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ladybird/AppKit/UI/LadybirdWebView.mm b/Ladybird/AppKit/UI/LadybirdWebView.mm index 1a7de7655f..7d913938db 100644 --- a/Ladybird/AppKit/UI/LadybirdWebView.mm +++ b/Ladybird/AppKit/UI/LadybirdWebView.mm @@ -1099,7 +1099,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_ - (void)scrollWheel:(NSEvent*)event { auto [position, screen_position, button, modifiers] = Ladybird::ns_event_to_mouse_event(event, self, GUI::MouseButton::Middle); - CGFloat delta_x = [event scrollingDeltaX]; + CGFloat delta_x = -[event scrollingDeltaX]; CGFloat delta_y = -[event scrollingDeltaY]; if (![event hasPreciseScrollingDeltas]) { delta_x *= [self scrollView].horizontalLineScroll;