Class: Element

Syntree.Element

An element in Syntree is any object that has a graphical representation and is related to the data of the tree. For example, a Node is an element, but the toolbar is not. Elements are Syntree.Node, Syntree.Branch, and Syntree.Arrow.

Constructor

new Element()

Source:

Members

deleted :boolean

Whether or not this element has been deleted. Needed to avoid double deletion.
Type:
  • boolean
Source:

id :number

A session-unique id.
Type:
  • number
Source:

selectable

Whether or not this element is selectable. Selectable elements are Syntree.Node, Syntree.Branch, Syntree.Arrow.
Source:
See:

Methods

delete()

Delete the element. Removes graphical elements, deregisters from Syntree.Workspace.page, and sets deleted property to true. Extend in sub-classes with '__delete()'.
Source:
See:

getId() → {number}

Accessor function for property id.
Source:
See:
  • Syntree.Element.id
Returns:
the id of the element
Type
number

isDeletable() → {boolean}

Whether or not this element is deletable. Deletable elements are Syntree.Node, Syntree.Branch, Syntree.Arrow. Syntree.Branch should never be deletable directly by the user. Branches should only be deleted automatically when their child node is deleted.
Source:
See:
  • Syntree.Node.__delete
Returns:
Type
boolean

isDeleted() → {boolean}

Accessor function for property deleted.
Source:
See:
  • Syntree.Element.deleted;
Returns:
whether or not the element is deleted
Type
boolean

isElement() → {boolean}

Whether or not this object is an element. Elements are Syntree.Node, Syntree.Branch, Syntree.Arrow.
Source:
Returns:
Type
boolean

isSelectable() → {boolean}

Accessor function for property selectable.
Source:
See:
Returns:
whether or not the element is selectable
Type
boolean

updateGraphics()

Update the elements graphical representation. Mostly serves as a wrapper for Syntree.Graphic.update. Extend in sub-classes with '__updateGraphics()'.
Source:
See: