Class Layer

Layers are how named collections of Parts are drawn in front or behind other collections of Parts in a Diagram. Layers can only contain Parts -- they cannot hold GraphObjects directly.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): Layer

This constructs an empty Layer; you should set the #name before adding the Layer to a Diagram.

Returns

Layer

Properties

public allowCopy: boolean

Gets or sets whether the user may copy objects in this layer.

public allowDelete: boolean

Gets or sets whether the user may delete objects in this layer.

public allowGroup: boolean

Gets or sets whether the user may group parts together in this layer.

public allowLink: boolean

Gets or sets whether the user may draw new links in this layer.

public allowMove: boolean

Gets or sets whether the user may move objects in this layer.

public allowRelink: boolean

Gets or sets whether the user may reconnect existing links in this layer.

public allowReshape: boolean

Gets or sets whether the user may reshape parts in this layer.

public allowResize: boolean

Gets or sets whether the user may resize parts in this layer.

public allowRotate: boolean

Gets or sets whether the user may rotate parts in this layer.

public allowSelect: boolean

Gets or sets whether the user may select objects in this layer.

public allowTextEdit: boolean

Gets or sets whether the user may do in-place text editing in this layer.

public allowUngroup: boolean

Gets or sets whether the user may ungroup existing groups in this layer.

public diagram: Diagram

Gets the Diagram that is using this Layer.

public isTemporary: boolean

Gets or sets whether the objects in this layer are considered temporary.

public name: string

Gets or sets the name for this layer.

public opacity: number

Gets or sets the opacity for all parts in this layer.

public parts: Iterator

Gets an iterator for this Layer's Parts.

public partsBackwards: Iterator

Gets a backwards iterator for this Layer's Parts, for iterating over the parts in reverse order.

public pickable: boolean

Gets or sets whether methods such as #findObjectAt find any of the objects in this layer.

public visible: boolean

Gets or sets whether the user may view any of the objects in this layer.

Methods

public findObjectAt(p: Point, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean): GraphObject

Find the front-most GraphObject in this layer at the given point in document coordinates.

Parameters

  • p: Point

    A Point in document coordinates.

  • navig?: (obj: go.GraphObject) => go.GraphObject optional

    A function taking a GraphObject and returning a GraphObject, defaulting to the identity.

  • pred?: (obj: go.GraphObject) => boolean optional

    A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.

Returns

GraphObject

public findObjectsAt(p: Point, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean, coll?: List): Iterable

Return a collection of the GraphObjects of this layer at the given point in document coordinates.

Parameters

  • p: Point

    A Point in document coordinates.

  • navig?: (obj: go.GraphObject) => go.GraphObject optional

    A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.

  • pred?: (obj: go.GraphObject) => boolean optional

    A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.

  • coll?: List optional

    An optional collection (List or Set) to add the results to.

Returns

Iterable

public findObjectsAt(p: Point, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean, coll?: Set): Iterable

Parameters

  • p: Point
  • navig?: (obj: go.GraphObject) => go.GraphObject optional
  • pred?: (obj: go.GraphObject) => boolean optional
  • coll?: Set optional

Returns

Iterable

public findObjectsIn(r: Rect, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean, partialInclusion?: boolean, coll?: List): Iterable

Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates.

Parameters

  • r: Rect

    A Rect in document coordinates.

  • navig?: (obj: go.GraphObject) => go.GraphObject optional

    A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.

  • pred?: (obj: go.GraphObject) => boolean optional

    A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.

  • partialInclusion?: boolean optional

    Whether an object can match if it merely intersects the rectangular area (true) or if it must be entirely inside the rectangular area (false). The default value is false.

  • coll?: List optional

    An optional collection (List or Set) to add the results to.

Returns

Iterable

public findObjectsIn(r: Rect, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable

Parameters

  • r: Rect
  • navig?: (obj: go.GraphObject) => go.GraphObject optional
  • pred?: (obj: go.GraphObject) => boolean optional
  • partialInclusion?: boolean optional
  • coll?: Set optional

Returns

Iterable

public findObjectsNear(p: Point, dist: number, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean, partialInclusion?: boolean, coll?: List): Iterable

Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates.

Parameters

  • p: Point

    A Point in document coordinates.

  • dist: number

    The distance from the point.

  • navig?: (obj: go.GraphObject) => go.GraphObject optional

    A function taking a GraphObject and returning a GraphObject, defaulting to the identity. If this function returns null, the given GraphObject will not be included in the results.

  • pred?: (obj: go.GraphObject) => boolean optional

    A function taking the GraphObject returned by navig and returning true if that object should be returned, defaulting to a predicate that always returns true.

  • partialInclusion?: boolean optional

    Whether an object can match if it merely intersects the circular area (true) or if it must be entirely inside the circular area (false). The default value is true.

  • coll?: List optional

    An optional collection (List or Set) to add the results to.

Returns

Iterable

public findObjectsNear(p: Point, dist: number, navig?: (obj: go.GraphObject) => go.GraphObject, pred?: (obj: go.GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable

Parameters

  • p: Point
  • dist: number
  • navig?: (obj: go.GraphObject) => go.GraphObject optional
  • pred?: (obj: go.GraphObject) => boolean optional
  • partialInclusion?: boolean optional
  • coll?: Set optional

Returns

Iterable