Update the docs for hitTest() (#5520)
This commit is contained in:
parent
dd2251ecf5
commit
43d0eeb8e1
@ -2126,22 +2126,22 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
|
|||||||
|
|
||||||
// HIT TESTING
|
// HIT TESTING
|
||||||
|
|
||||||
// RenderObject subclasses are expected to have a method like the
|
// RenderObject subclasses are expected to have a method like the following
|
||||||
// following (with the signature being whatever passes for coordinates
|
// (with the signature being whatever passes for coordinates for this
|
||||||
// for this particular class):
|
// particular class):
|
||||||
|
//
|
||||||
// bool hitTest(HitTestResult result, { Point position }) {
|
// bool hitTest(HitTestResult result, { Point position }) {
|
||||||
// // If (x,y) is not inside this node, then return false. (You
|
// // If the given position is not inside this node, then return false.
|
||||||
// // can assume that the given coordinate is inside your
|
|
||||||
// // dimensions. You only need to check this if you're an
|
|
||||||
// // irregular shape, e.g. if you have a hole.)
|
|
||||||
// // Otherwise:
|
// // Otherwise:
|
||||||
// // For each child that intersects x,y, in z-order starting from the top,
|
// // For each child that intersects the position, in z-order starting from
|
||||||
// // call hitTest() for that child, passing it /result/, and the coordinates
|
// // the top, call hitTest() for that child, passing it /result/, and the
|
||||||
// // converted to the child's coordinate origin, and stop at the first child
|
// // coordinates converted to the child's coordinate origin, and stop at
|
||||||
// // that returns true.
|
// // the first child that returns true.
|
||||||
// // Then, add yourself to /result/, and return true.
|
// // Then, add yourself to /result/, and return true.
|
||||||
// }
|
// }
|
||||||
// You must not add yourself to /result/ if you return false.
|
//
|
||||||
|
// If you add yourself to /result/ and still return false, then that means you
|
||||||
|
// will see events but so will objects below you.
|
||||||
|
|
||||||
|
|
||||||
/// Returns a human understandable name.
|
/// Returns a human understandable name.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user