DynamicTemplate

Warning

This base interface is only used for type checking!

Every dynamic template MUST implement the specific interface!

class DynamicTemplate()

Interface for dynamic templates.

A dynamic template should never store any state as it may be used by many nodes! As the dynamic template mechanism only complements the normal static template mechanism all dynamic templates can benefit from the dynamic content loading already implemented for static templates. Text injection and other things can still be used with dynamic templates by setting the right attributes and classes.

interface

DynamicTemplate.renderInitialTemplate(g, grapheditor, context)

The initial render function that renders the (static part of) template structure into the svg group.

This function is called once every time a node is assigned to this dynamic template. The svg group is empty when this function gets called. The intention of this function is to render the static structure of the template and not the dynamic content of the template. The dynamic contetn should be rendered in the updateTemplate function.

Arguments:
  • g (Selection<SVGGElement, T, any, unknown>) –

  • grapheditor (default) –

  • context (DynamicTemplateContext<T>) –

DynamicTemplate.updateTemplate(g, grapheditor, context)

The update function updates the dynamic parts of the template.

This function will be called on every graph render. It will only be called after

renderInitialTemplate was called for this group.

Dynamic text and other dynamic content that is already implemented for static templates can be used by setting the corresponding attributes and classes. This is preferred over updating the text in this function.

Arguments:
  • g (Selection<SVGGElement, T, any, unknown>) –

  • grapheditor (default) –

  • context (DynamicTemplateContext<T>) –

DynamicNodeTemplate

class DynamicNodeTemplate()

Interface for dynamic templates for graph nodes.

interface

Extends:
DynamicNodeTemplate.getLinkHandles(g, grapheditor)

Get the link handle list for the current node.

This function should not update the group itself!

Arguments:
  • g (Selection<SVGGElement, Node, any, unknown>) –

  • grapheditor (default) –

Returns:

LinkHandle[]

DynamicMarkerTemplate

class DynamicMarkerTemplate()

Interface for dynamic marker/link-handle templates.

interface

Extends:
DynamicMarkerTemplate.getLineAttachementInfo(g)

Calculate the LineAttachement info that is used to calculate the actual point where the edge attaches to the marker if it is an end marker.

This method can safely return null (defaults to no offset).

Arguments:
  • g (Selection<SVGGElement, Marker, any, unknown>) –

Returns:

LineAttachementInfo

DynamicMarkerTemplate.renderInitialTemplate(g, grapheditor, context)
Arguments:
DynamicMarkerTemplate.updateTemplate(g, grapheditor, context)
Arguments:

DynamicTextComponentTemplate

class DynamicTextComponentTemplate()

Interface for dynamic text component templates.

interface

Extends:
DynamicTextComponentTemplate.renderInitialTemplate(g, grapheditor, context)
Arguments:
DynamicTextComponentTemplate.updateAfterTextwrapping(g, grapheditor, context)

Same as the updateTemplate function but called after text was wrapped.

This function can be used to change the template according to the actual text measures.

Arguments:
DynamicTextComponentTemplate.updateTemplate(g, grapheditor, context)
Arguments:

DefaultTextComponentTemplate

class DefaultTextComponentTemplate()

Default implementation of the dynamic text component template interface.

Adds a single text element to the group.

Implements:
Returns:

DefaultTextComponentTemplate

DefaultTextComponentTemplate.renderInitialTemplate(g, grapheditor, context)
Arguments:
DefaultTextComponentTemplate.updateAfterTextwrapping(g, grapheditor, context)

Same as the updateTemplate function but called after text was wrapped.

This function can be used to change the template according to the actual text measures.

Arguments:
DefaultTextComponentTemplate.updateTemplate(g, grapheditor, context)
Arguments: