Unverified Commit f4a6b218 authored by xubaolin's avatar xubaolin Committed by GitHub

Fix a rotation gesture bug (#79035)

parent e4ad46c8
...@@ -441,7 +441,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer { ...@@ -441,7 +441,7 @@ class ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
pointerEndId: _pointerQueue[1], pointerEndId: _pointerQueue[1],
pointerEndLocation: _pointerLocations[_pointerQueue[1]]!, pointerEndLocation: _pointerLocations[_pointerQueue[1]]!,
); );
_currentLine = null; _currentLine = _initialLine;
} }
} }
......
...@@ -572,6 +572,34 @@ void main() { ...@@ -572,6 +572,34 @@ void main() {
tap.dispose(); tap.dispose();
}); });
// Regressing test for https://github.com/flutter/flutter/issues/78941
testGesture('First rotation test', (GestureTester tester) {
final ScaleGestureRecognizer scale = ScaleGestureRecognizer();
double? updatedRotation;
scale.onUpdate = (ScaleUpdateDetails details) {
updatedRotation = details.rotation;
};
final TestPointer pointer1 = TestPointer(1);
final PointerDownEvent down = pointer1.down(Offset.zero);
scale.addPointer(down);
tester.closeArena(1);
tester.route(down);
final TestPointer pointer2 = TestPointer(2);
final PointerDownEvent down2 = pointer2.down(const Offset(10.0, 10.0));
scale.addPointer(down2);
tester.closeArena(2);
tester.route(down2);
expect(updatedRotation, isNull);
// Rotation 45°.
tester.route(pointer2.move(const Offset(0.0, 10.0)));
expect(updatedRotation, math.pi / 4.0);
});
testGesture('Scale gestures pointer count test', (GestureTester tester) { testGesture('Scale gestures pointer count test', (GestureTester tester) {
final ScaleGestureRecognizer scale = ScaleGestureRecognizer(); final ScaleGestureRecognizer scale = ScaleGestureRecognizer();
......
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