Unverified Commit 8ab513a0 authored by Justin McCandless's avatar Justin McCandless Committed by GitHub

InteractiveViewer scroll direction (#60523)

parent c543db70
......@@ -848,7 +848,7 @@ class _InteractiveViewerState extends State<InteractiveViewer> with TickerProvid
if (event is PointerScrollEvent) {
final RenderBox childRenderBox = _childKey.currentContext.findRenderObject() as RenderBox;
final Size childSize = childRenderBox.size;
final double scaleChange = 1.0 + event.scrollDelta.dy / childSize.height;
final double scaleChange = 1.0 - event.scrollDelta.dy / childSize.height;
if (scaleChange == 0.0) {
return;
}
......
......@@ -7,10 +7,10 @@
import 'package:flutter/gestures.dart';
import 'package:flutter_test/flutter_test.dart';
Future<void> scrollAt(Offset position, WidgetTester tester) {
Future<void> scrollAt(Offset position, WidgetTester tester, [Offset offset = const Offset(0.0, 20.0)]) {
final TestPointer testPointer = TestPointer(1, PointerDeviceKind.mouse);
// Create a hover event so that |testPointer| has a location when generating the scroll.
testPointer.hover(position);
final HitTestResult result = tester.hitTestOnBinding(position);
return tester.sendEventToBinding(testPointer.scroll(const Offset(0.0, 20.0)), result);
return tester.sendEventToBinding(testPointer.scroll(offset), result);
}
......@@ -422,7 +422,7 @@ void main() {
);
final Offset center = tester.getCenter(find.byType(InteractiveViewer));
await scrollAt(center, tester);
await scrollAt(center, tester, const Offset(0.0, -20.0));
await tester.pumpAndSettle();
expect(transformationController.value.getMaxScaleOnAxis(), greaterThan(1.0));
......@@ -445,7 +445,7 @@ void main() {
);
final Offset center = tester.getCenter(find.byType(InteractiveViewer));
await scrollAt(center, tester);
await scrollAt(center, tester, const Offset(0.0, -20.0));
await tester.pumpAndSettle();
expect(transformationController.value.getMaxScaleOnAxis(), equals(1.0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment