Interface for any object that can contain Layer.

interface HasLayers {
    hasLayers: true;
    get layerCount(): number;
    forEachLayer(callback): void;
    getLayers(predicate?): Layer<LayerEvents, LayerUserData>[];
}

Implemented by

Properties

Accessors

Methods

Properties

hasLayers: true

Read-only flag to check if a given object is of type HasLayers.

Accessors

  • get layerCount(): number
  • Returns the number of layers currently in this object.

    Returns number

Methods

  • Returns a new array containing the layers in this object. Optionally, the predicate can be used to filter out unwanted layers.

    // Get all layers from the object.
    const allLayers = obj.getLayers();

    // Get all color layers from the object.
    const colorLayers = obj.getLayers((layer) => layer.isColorLayer);

    Parameters

    Returns Layer<LayerEvents, LayerUserData>[]