getFurthestFrom(object, callback, callbackContext) → {any}
Get the child furthest away from the given Object, with optional callback to filter children.
This can be a Sprite, Group, Image or any object with public x and y properties.
'furthest away' is determined by the distance from the objects x
and y
properties compared to the childs x
and y
properties.
You can use the optional callback
argument to apply your own filter to the distance checks.
If the child is closer then the previous child, it will be sent to callback
as the first argument,
with the distance as the second. The callback should return true
if it passes your
filtering criteria, otherwise it should return false
.
Parameters
Name | Type | Argument | Description |
---|---|---|---|
object | any | The object used to determine the distance. This can be a Sprite, Group, Image or any object with public x and y properties. | |
callback | function | <optional> | The function that each child will be evaluated against. Each child of the group will be passed to it as its first parameter, with the distance as the second. It should return |
callbackContext | object | <optional> | The context in which the function should be called (usually 'this'). |
Returns
The child furthest from the given object, or null
if no child was found.
- Inherited From
- Source code: core/Group.js (Line 2282)
Please login to continue.