Class: ObservablePoint

Tiny. 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 observable point is a point that triggers a callback when the point's position is changed.

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

Name Type Default Description
cb function

callback when changed

scope object

owner of callback

x number 0 optional

position of the point on the x axis

y number 0 optional

position of the point on the y axis

Members

xnumber

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

ynumber

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 Default Description
cb function null optional

callback when changed

scope object null optional

owner of callback

Version:
  • 1.2.0
Returns:
Type Description
Tiny.ObservablePoint a copy of the point

Copies the data from another point

Name Type Description
point Tiny.Point | Tiny.ObservablePoint

point to copy from

equals(p){boolean}

Returns true if the given point is equal to this point

Name Type Description
p Tiny.Point | Tiny.ObservablePoint

The point to check

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

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 Default Description
x number 0 optional

position of the point on the x axis

y number 0 optional

position of the point on the y axis

Documentation generated by JSDoc 3.4.3 on Mon Dec 03 2018 17:48:52 GMT+0800 (CST)