Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ObservablePoint<T>

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.

memberof

PIXI

implements

IPoint

Type parameters

  • T = any

Hierarchy

  • ObservablePoint

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new ObservablePoint<T>(cb: () => any, scope: T, x?: number, y?: number): ObservablePoint<T>
  • Creates a new ObservablePoint

    Type parameters

    • T = any

    Parameters

    • cb: () => any

      callback function triggered when x and/or y are changed

        • (): any
        • Returns any

    • scope: T

      owner of callback

    • Optional x: number
    • Optional y: number

    Returns ObservablePoint<T>

Properties

_x

_x: number

_y

_y: number

cb

cb: () => any

Type declaration

    • (): any
    • The callback function triggered when x and/or y are changed

      Returns any

scope

scope: any

The owner of the callback

Accessors

x

  • get x(): number
  • set x(value: number): void
  • Position of the observable point on the x axis

    Returns number

  • Position of the observable point on the x axis

    Parameters

    • value: number

    Returns void

y

  • get y(): number
  • set y(value: number): void
  • Position of the observable point on the y axis

    Returns number

  • Position of the observable point on the y axis

    Parameters

    • value: number

    Returns void

Methods

clone

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

    override

    Parameters

    • Optional cb: () => any

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

        • (): any
        • Returns any

    • Optional scope: any

      The owner of the callback

    Returns ObservablePoint<any>

    a copy of this observable point

copyFrom

  • Copies x and y from the given point (p)

    Parameters

    • p: IPointData

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

    Returns ObservablePoint<T>

    The observable point instance itself

copyTo

  • copyTo<T>(p: T): T
  • Copies this point's x and y into that of the given point (p)

    Type parameters

    Parameters

    • p: T

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

    Returns T

    The point (p) with values updated

equals

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

    Parameters

    Returns boolean

    Returns true if both x and y are equal

set

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

    Parameters

    • Optional x: number
    • Optional y: number

    Returns ObservablePoint<T>

    The observable point instance itself

toString

  • toString(): string
  • Returns string

Generated using TypeDoc