Skip to main content

Element model attributes

Beside the model attributes which are common for all shapes, elements have its own set of unique model attributes.

Geometry attributes

  • position - coordinates of the element, provided as an object with x and y keys. The property may be accessed or set directly using regular mvc.Model set('position')/get('position') methods or through Element's translate() method.
  • angle - angle of rotation of the element in degrees. The rotation origin is always the center of the element. The property may be accessed or set directly using regular mvc.Model set('angle')/get('angle') methods or through element's rotate() method.
  • size - size of the element, provided as an object with width and height keys. The property may be accessed or set directly using regular mvc.Model set('size')/get('size') methods or through Element's resize() method.

Ports

You may define and group ports on the element with the ports attribute. Each can have its own markup and attrs, and its own label. Grouped ports may share properties and behaviors. See the element ports documentation for more information.

Nesting

Another two model attributes of elements are embeds and parent. These two are related to elements that contain or are contained within other elements, forming a hierarchical structure.

  • embeds - a list of id's of the shapes (cells) that are embedded inside this element.
  • parent - the id of the element that is the parent of this element. When a parent element is translated, all its children get translated too.

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub