Interfaces

A set of common interfaces shared by various Foundation types


Implementation Details

Reference paths

  • '/foundation/_digest.ts'
  • '/foundation/core/common/_digest.ts'
  • '/foundation/core/common/interfaces.ts'

Object

Interface shared by all Foundation types

clone(): object

  • Returns a deep copy of the current object.

equals(o: Object): boolean

  • Checks for object equality based on object properties

Transformable

Implemented in types which can move in 2D space

transform(arg: Object): Object

  • Applies transformations from the input object, which will most likely be a matrix.
  • Returns the current object for chaining.

translate(x: number, y: number): Object

  • Move the current object in 2D space.
  • Returns the current object for chaining.

setTo(t: Transformable): Transformable

  • Sets the components of the current Transformable to those in t
  • Returns the current object for chaining.

Updatable

Implemented in types which can be collected in loop update lists.

active: boolean

  • True if the item is currently considered active.

update(): boolean

  • Returns true to indicate that the object has updated.

Drawable

Implemented in types which can be collected in loop draw lists.

alpha: number

  • Returns the object's alpha value in the range 0 - 1.

bounds: Rectangle

  • Returns the bounding box of the item (wrapping transform, if applicable).

getOriginalBounds: Rectangle

  • Returns the original bounds of the item before transformations, if applicable.

overlaps (other: {bounds: Rectangle}): boolean

  • Returns true if the current drawable and the passed bounded item overlap.

layer: Layer

  • Returns the layer the current item is attached to. May be null (not attached to a layer).

Shape

This interface further implements the following interfaces:

overlaps(s: Shape): boolean

  • Returns true if the current shape and s overlap.

contains(v: {x: number, y: number}): boolean

  • Returns true if the point v is contained in the bounds of the current shape.

midpoint(v?: {x: number, y: number}): {x: number, y: number}

  • Returns the midpoint of the current shape.
  • Optionally, an object can be passed to serve as the output object.

topleft(v?: {x: number, y: number}): {x: number, y: number}

  • Returns the topleft point of the current shape.
  • Optionally, an object can be passed to serve as the output object.

width: number

  • Returns the width of the current shape
  • Available: 0.6+

height: number

  • Returns the height of the current shape
  • Available: 0.6+

UpdatableDrawable

This interface further implements the following interfaces:


TransformableObject

This interface further implements the following interfaces: