Class: Graphic

Syntree.Graphic

Instantiated for each new Element. Manages all graphical representation.

Constructor

new Graphic()

Source:

Members

data_object :Syntree.Element

The Element that this Graphic is a member of.
Type:
Source:

elements :object

All the graphical elements.
Type:
  • object
Properties:
Name Type Description
element.el_obj object the actual Snap Element or jQuery Object
element.attr_handler function a function to handle attribute updating
element.include_in_svg_string boolean whether or not to include this element in the SVG string
Source:

elements_to_add :object

Elements to add to Graphic. Initialization property only.
Type:
  • object
Source:

states_synced :object

States of this instance's data object that need to be mapped to graphical updates.
Type:
  • object
Source:

update_map :object

Information about how to update graphical elements based on state changes.
Type:
  • object
Source:

Methods

(static) Syntree.Arrow#createGraphic()

Create graphical elements and compile them into a new instance of Syntree.Graphic.
Source:

_defaultAttrHandler(element, attrs)

The default attr handler for graphical elements.
Parameters:
Name Type Description
element object a Snap Element (or other graphical element)
attrs object attrs to set
Source:
See:

_handlerBoolean()

Handler for data states of type boolean -- for example, Syntree.SelectableElement#selected.
Source:

addElement(name, element)

Add a graphical element.
Parameters:
Name Type Description
name string the name of the element
element object data about the element
Properties
Name Type Attributes Default Description
el_obj object the actual Snap Element or jQuery Object
attr_handler function <optional>
Syntree.Graphic._defaultAttrHandler a function to handle attribute updating
include_in_svg_string boolean <optional>
false whether or not to include this element in the SVG string
Source:

delete()

Delete all graphical elements.
Source:

getAllEls() → {object}

Get all graphical elements.
Source:
See:
Returns:
- all elements
Type
object

getEl(name)

Get an element by name.
Parameters:
Name Type Description
name string name of the element
Source:
See:

getSVGString() → {string}

Get an SVG string represnting all elements marked with include_in_svg_string.
Source:
See:
Returns:
- string of SVG markup
Type
string

sync()

Tell this Graphic instance that the state with state_name is correctly represented in the graphical layer.
Source:
See:

unsync(state_name)

Tell this Graphic instance that the state with state_name has been changed in the data object.
Parameters:
Name Type Description
state_name string state name
Source:
See:

update()

Update all graphical elements.
Source: