hitTest method
- @override
Determines the set of render objects located at the given position.
Returns true, and adds any render objects that contain the point to the given hit test result, if this render object or one of its descendants absorbs the hit (preventing objects below this one from being hit). Returns false if the hit can continue to other objects below this one.
The caller is responsible for transforming position
into the local
coordinate space of the callee. The callee is responsible for checking
whether the given position is within its bounds.
Hit testing requires layout to be up-to-date but does not require painting
to be up-to-date. That means a render object can rely upon performLayout
having been called in hitTest but cannot rely upon paint having been
called. For example, a render object might be a child of a RenderOpacity
object, which calls hitTest on its children when its opacity is zero
even through it does not paint its children.
Implementation
@override
bool hitTest(HitTestResult result, { Offset position }) {
result.add(new _SpriteBoxHitTestEntry(this, position));
return true;
}