Commit c4127ee6 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Fix the transforms for horizontal glows. (#8252)

Also, make all painters have a toString by default.
parent 4a02afad
......@@ -1777,6 +1777,9 @@ abstract class CustomPainter {
/// point that should be considered outside the painted image, and null to use
/// the default behavior.
bool hitTest(Point position) => null;
@override
String toString() => '$runtimeType#$hashCode';
}
/// Provides a canvas on which to draw during the paint phase.
......
......@@ -450,16 +450,15 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter {
break;
case AxisDirection.left:
canvas.save();
canvas.translate(0.0, size.height);
canvas.rotate(-piOver2);
canvas.rotate(piOver2);
canvas.scale(1.0, -1.0);
controller.paint(canvas, new Size(size.height, size.width));
canvas.restore();
break;
case AxisDirection.right:
canvas.save();
canvas.translate(size.width, size.height);
canvas.rotate(-piOver2);
canvas.scale(1.0, -1.0);
canvas.translate(size.width, 0.0);
canvas.rotate(piOver2);
controller.paint(canvas, new Size(size.height, size.width));
canvas.restore();
break;
......
......@@ -187,11 +187,11 @@ void main() {
);
RenderObject painter = tester.renderObject(find.byType(CustomPaint));
await slowDrag(tester, const Point(200.0, 200.0), const Offset(5.0, 0.0));
expect(painter, paints..rotate(angle: -math.PI / 2.0)..circle()..scale(y: -1.0));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle()..saveRestore());
expect(painter, isNot(paints..circle()..circle()));
await slowDrag(tester, const Point(200.0, 200.0), const Offset(-5.0, 0.0));
expect(painter, paints..rotate(angle: -math.PI / 2.0)..circle()
..rotate(angle: -math.PI / 2.0)..scale(y: -1.0)..circle());
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle()
..rotate(angle: math.PI / 2.0)..circle());
await tester.pumpUntilNoTransientCallbacks(const Duration(seconds: 1));
expect(painter, doesNotOverscroll);
......@@ -237,7 +237,7 @@ void main() {
);
painter = tester.renderObject(find.byType(CustomPaint));
await slowDrag(tester, const Point(200.0, 200.0), const Offset(5.0, 0.0));
expect(painter, paints..scale(y: -1.0)..rotate(angle: -math.PI / 2.0)..circle(color: const Color(0x0A00FF00)));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle(color: const Color(0x0A00FF00)));
expect(painter, isNot(paints..circle()..circle()));
await tester.pumpUntilNoTransientCallbacks(const Duration(seconds: 1));
......@@ -254,7 +254,7 @@ void main() {
);
painter = tester.renderObject(find.byType(CustomPaint));
await slowDrag(tester, const Point(200.0, 200.0), const Offset(5.0, 0.0));
expect(painter, paints..rotate(angle: -math.PI / 2.0)..circle(color: const Color(0x0A0000FF))..scale(y: -1.0));
expect(painter, paints..rotate(angle: math.PI / 2.0)..circle(color: const Color(0x0A0000FF))..saveRestore());
expect(painter, isNot(paints..circle()..circle()));
});
}
......
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