A set of DisplayObject's, which show the state of the simulation. A DisplayObject typically represents a SimObject, but not always.

zIndex

DisplayObjects with a lower zIndex appear underneath those with higher zIndex. The DisplayList is sorted by zIndex. See DisplayObject.getZIndex.

Hierarchy (view full)

Implements

Constructors

Properties

OBJECT_ADDED: "OBJECT_ADDED" = 'OBJECT_ADDED'

Name of event broadcast when a DisplayObject is added, see add, prepend.

OBJECT_REMOVED: "OBJECT_REMOVED" = 'OBJECT_REMOVED'

Name of event broadcast when a DisplayObject is removed, see remove, removeAll.

Methods

  • Adds the DisplayObject, inserting it at the end of the group of DisplayObjects with the same zIndex; the item will appear visually over objects that have the same (or lower) zIndex.

    Parameters

    Returns void

  • Returns true if this DisplayList contains the given DisplayObject.

    Parameters

    Returns boolean

    true if the DisplayObject was found

  • Draws the DisplayObjects in order, which means that DisplayObjects drawn later (at the end of the list) will appear to be on top of those drawn earlier (at start of the list).

    Parameters

    • context: CanvasRenderingContext2D

      the canvas's context to draw this object into

    • map: CoordMap

      the mapping to use for translating between simulation and screen coordinates

    Returns void

  • Returns the DisplayObject that shows the given SimObject.

    Parameters

    • search: string | number | SimObject

      the SimObject to search for, or name of SimObject, or index number of DisplayObject. Name should be English or language-independent version of name.

    Returns undefined | DisplayObject

    the DisplayObject on this list that shows the given SimObject, or undefined if not found

  • Returns the DisplayShape that shows the given SimObject.

    Parameters

    • search: string | number | SimObject

      the SimObject to search for, or name of SimObject, or index number of DisplayObject. Name should be English or language-independent version of name.

    Returns DisplayShape

    the DisplayShape on this list that shows the given SimObject

    Throws

    if DisplayShape is not found

  • Returns the DisplaySpring that shows the given SimObject.

    Parameters

    • search: string | number | SimObject

      the SimObject to search for, or name of SimObject, or index number of DisplayObject. Name should be English or language-independent version of name.

    Returns DisplaySpring

    the DisplaySpring on this list that shows the given SimObject

    Throws

    if DisplaySpring is not found

  • Returns the DisplayObject at the specified position in this DisplayList

    Parameters

    • index: number

      index number of DisplayObject

    Returns DisplayObject

    the DisplayObject at the specified position in this DisplayList

    Throws

    if index out of range

  • Returns true if any DisplayObject on this DisplayList has changed, and sets the state to "unchanged".

    Returns boolean

    whether any DisplayObject on this DisplayList this DisplayObject has changed

  • Returns number of DisplayObjects in this DisplayList, minus 1.

    Returns number

    number of DisplayObjects minus 1

  • Adds the DisplayObject, inserting it at the front of the group of DisplayObjects with the same zIndex; the item will appear visually under objects that have the same (or higher) zIndex.

    Parameters

    Returns void

  • Sets whether this Subject will broadcast events, typically used to temporarily disable broadcasting. Intended to be used in situations where a subclass overrides a method that broadcasts an event. This allows the subclass to prevent the superclass broadcasting that event, so that the subclass can broadcast the event when the method is completed.

    Parameters

    • value: boolean

      whether this Subject should broadcast events

    Returns boolean

    the previous value

  • Sorts the DisplayList by zIndex. Avoids sorting if the list is already sorted.

    Returns void

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:

    DisplayShape{polygon:Polygon{'chain3'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc