Merge pull request #1051 from abarth/default_hit_test_children

defaultHitTestChildren should return whether it hit something
This commit is contained in:
Adam Barth 2015-09-03 17:18:02 -07:00
commit bc169671c8

View File

@ -519,7 +519,7 @@ abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
return result; return result;
} }
void defaultHitTestChildren(HitTestResult result, { Point position }) { bool defaultHitTestChildren(HitTestResult result, { Point position }) {
// the x, y parameters have the top left of the node's box as the origin // the x, y parameters have the top left of the node's box as the origin
ChildType child = lastChild; ChildType child = lastChild;
while (child != null) { while (child != null) {
@ -527,9 +527,10 @@ abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare
Point transformed = new Point(position.x - child.parentData.position.x, Point transformed = new Point(position.x - child.parentData.position.x,
position.y - child.parentData.position.y); position.y - child.parentData.position.y);
if (child.hitTest(result, position: transformed)) if (child.hitTest(result, position: transformed))
break; return true;
child = child.parentData.previousSibling; child = child.parentData.previousSibling;
} }
return false;
} }
void defaultPaint(PaintingContext context, Offset offset) { void defaultPaint(PaintingContext context, Offset offset) {