Class ObservableVector2d

A Vector2d object that provide notification by executing the given callback when the vector is changed.

Hierarchy (view full)

Constructors

  • Parameters

    • x: number = 0

      x value of the vector

    • y: number = 0

      y value of the vector

    • settings: {
          onUpdate: Function;
          scope: undefined | Function;
      }

      additional required parameters

      • onUpdate: Function

        the callback to be executed when the vector is changed

      • scope: undefined | Function

        the value to use as this when calling onUpdate

    Returns ObservableVector2d

Properties

_x: any
_y: any
onUpdate: undefined | Function
scope: undefined | Function

Accessors

Methods

  • Project this vector onto a vector of unit length.
    This is slightly more efficient than project when dealing with unit vectors.

    Parameters

    • v: Vector2d

      The unit vector to project onto.

    Returns Vector2d

    Reference to this object for method chaining