Layer class

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, such as Nodes and Links. They cannot hold GraphObjects directly.

You put a Part into a Layer by assigning Part#layerName with the name of the Layer. You can use data binding to initialize and remember a Part's layer's name. You can change a Part's layer by modifying its Part#layerName, which changes its Part#layer.

Each Diagram starts off with the following list of Layers: "Grid", "Background", "" (the default layer), "Foreground", "Adornment", "Tool". Parts are normally put in the default layer. The "Grid", "Adornment", and "Tool" layers are considered #isTemporary. Changes to objects in temporary layers are not recorded by the UndoManager. Parts in temporary layers are not selected and are not considered to be part of the document. Objects in temporary layers do not receive click events unless you set their GraphObject#isActionable to true. The "Grid" layer is the furthest back; it also contains "temporary" parts that cannot be selected. Furthermore the "Grid" layer has #pickable set to false so that mouse or touch events and calls to the "find..." methods do not even consider any parts in that layer.

Layers have many properties that control what actions users are permitted to perform involving the parts in the layer. These properties are very much like the similarly named properties on Diagram.

Z-ordering

Layers are drawn and presented in order. You can add your own layers by calling Diagram#addLayerBefore or Diagram#addLayerAfter to insert a new layer at a particular place in the Z-order, or to re-order existing layers. Use Diagram#findLayer to get the Layer with a particular name. Parts can be individually z-ordered within a layer by setting Part#zOrder.

Available Extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

Layer([dynamic init])
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited