Fix horizontal scroll direction for macOS (#9022)

macOS uses negative values to represent scrolls to the right, while
Flutter expects the opposite, so flip X deltas.
This commit is contained in:
stuartmorgan 2019-05-20 17:01:29 -04:00 committed by GitHub
parent dbf083bda1
commit e1599ccd3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -486,7 +486,7 @@ static void CommonInit(FLEViewController* controller) {
}
}
double scaleFactor = self.view.layer.contentsScale;
flutterEvent.scroll_delta_x = event.scrollingDeltaX * pixelsPerLine * scaleFactor;
flutterEvent.scroll_delta_x = -event.scrollingDeltaX * pixelsPerLine * scaleFactor;
flutterEvent.scroll_delta_y = -event.scrollingDeltaY * pixelsPerLine * scaleFactor;
}
FlutterEngineSendPointerEvent(_engine, &flutterEvent, 1);