Class: ObservablePoint

PIXI.ObservablePoint

The Point object represents a location in a two-dimensional coordinate system, where x represents the horizontal axis and y represents the vertical axis.

An ObservablePoint is a point that triggers a callback when the point's position is changed.

new PIXI.ObservablePoint (cb, scope, x, y)

Name Type Attributes Default Description
cb Function

callback when changed

scope object

owner of callback

x number <optional>
0

position of the point on the x axis

y number <optional>
0

position of the point on the y axis

Implements

  • IPoint

Members

x number

The position of the displayObject on the x axis relative to the local coordinates of the parent.

y number

The position of the displayObject on the x axis relative to the local coordinates of the parent.

Methods

Creates a clone of this point. The callback and scope params can be overidden otherwise they will default to the clone object's values.

Name Type Attributes Default Description
cb Function <optional>
null

callback when changed

scope object <optional>
null

owner of callback

Returns:
Type Description
PIXI.ObservablePoint a copy of the point

copyFrom (p) this

Copies x and y from the given point

Name Type Description
p PIXI.IPointData

The point to copy from.

Returns:
Type Description
this Returns itself.

Copies x and y into the given point

Name Type Description
p PIXI.IPoint

The point to copy.

Returns:
Type Description
PIXI.IPoint Given point with values updated

equals (p) boolean

Returns true if the given point is equal to this point

Name Type Description
p PIXI.IPointData

The point to check

Returns:
Type Description
boolean Whether the given point equal to this point

set (x, y) this

Sets the point to a new x and y position. If y is omitted, both x and y will be set to x.

Name Type Attributes Default Description
x number <optional>
0

position of the point on the x axis

y number <optional>
x

position of the point on the y axis

Returns:
Type Description
this Returns itself.