new CoordinatesHelper()
Methods
-
<static> contains(point, sprite)
-
Checks if a point is contained inside a sprite
Parameters:
Name Type Description pointPhaser.Point A Point
spritePhaser.Sprite | Phaser.Group A Sprite or Group
Returns:
- Type
- boolean
-
<static> findCommonAncestor(element)
-
Given an object, it returns the list of its ancestors, from the nearest to the farest
Parameters:
Name Type Description elementPhaser.Sprite | Phaser.Group The Sprite or Group
-
<static> getTree(element)
-
Given an object, it returns the list of its ancestors, from the nearest to the farest
Parameters:
Name Type Description elementPhaser.Sprite | Phaser.Group The Sprite or Group
-
<static> pointInAncestor(sprite, ancestor [, pivot])
-
Given a sprite and one of its ancestors, it returns the coordinates of the sprite relative to its ancestor coordinate system
Parameters:
Name Type Argument Default Description spritePhaser.Sprite A Sprite
ancestorPhaser.Sprite | Phaser.Group A Sprite's ancestor
pivotPhaser.Point <optional>
new Phaser.Point(0.5, 0.5) The pivot
Returns:
The computed point
- Type
- Phaser.Point
-
<static> pointInDescendant(point, reference, descendant)
-
Converts a point in an element coordinate system in one of it's descendant coordinates
Parameters:
Name Type Description pointPhaser.Point A Point in
referencecoordinate systemreferencePhaser.Sprite | Phaser.Group A reference Sprite or Group
descendantPhaser.Sprite | Phaser.Group A descendant Sprite or Group
Returns:
The computed point
- Type
- Phaser.Point
-
<static> transformCoordinates(source, destination)
-
Given a source and destination graphic, it returns the coordinates of
sourcerelated to thedestinationcoordinate systemParameters:
Name Type Description sourcePhaser.Sprite | Phaser.Group The Sprite or Group to be dragged
destinationPhaser.Sprite | Phaser.Group The Sprite or Group to be dragged
Returns:
The computed point
- Type
- Phaser.Point