Class: ObservablePoint

PIXI.ObservablePoint

The ObservablePoint object represents a location in a two-dimensional coordinate system, where x represents the position on the horizontal axis and y represents the position on 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)

Creates a new ObservablePoint

Name Type Attributes Default Description
cb (this: T) => any

callback function triggered when x and/or y are changed

scope T

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

cb (this: T) => any

The callback function triggered when x and/or y are changed

scope any

The owner of the callback

x number

Position of the observable point on the x axis

y number

Position of the observable point on the y axis

Methods

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

Name Type Description
cb

The callback function triggered when x and/or y are changed

scope

The owner of the callback

Returns:
Type Description
PIXI.ObservablePoint a copy of this observable point

copyFrom (p) this

Copies x and y from the given point (p)

Name Type Description
p IPointData

The point to copy from. Can be any of type that is or extends IPointData

Returns:
Type Description
this The observable point instance itself

copyTo (p) T

Copies this point's x and y into that of the given point (p)

Name Type Description
p T

The point to copy to. Can be any of type that is or extends IPointData

Returns:
Type Description
T The point (p) with values updated

equals (p) boolean

Accepts another point (p) and returns true if the given point is equal to this point

Name Type Description
p IPointData

The point to check

Returns:
Type Description
boolean Returns true if both x and y are equal

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 The observable point instance itself