BasePainter

BasePainter

new BasePainter(domopt)

Base painter class

Source:
Parameters:
Name Type Attributes Description
dom object | string <optional>

dom element or id of dom element

Methods

(abstract, protected) checkResize() → {boolean}

Checks if draw elements were resized and drawing should be updated

Source:
Returns:

true if resize was detected

Type
boolean

cleanup()

Generic method to cleanup painter

Source:

Removes all visible elements and all internal data

(protected) clearTopPainter()

Clear reference on top painter

Source:

(protected) enlargeMain(action)

Try enlarge main drawing element to full HTML page.

Source:

Possible values for action parameter:

  • true - try to enlarge
  • false - revert enlarge state
  • 'toggle' - toggle enlarge state
  • 'state' - only returns current enlarge state
  • 'verify' - check if element can be enlarged if action not specified, just return possibility to enlarge main div
Parameters:
Name Type Description
action string | boolean

defines that should be done

getDom()

Returns assigned dom element

Source:

getItemDrawOpt()

Returns assigned item draw option

Source:

Used with HierarchyPainter to identify drawn item option

getItemName()

Returns assigned item name

Source:

Used with HierarchyPainter to identify drawn item name

(protected) getTopPainter()

Return top painter set for the selected dom element

Source:

selectDom(is_directopt) → {object}

Selects main HTML element assigned for drawing

Source:

if main element was layouted, returns main element inside layout

Parameters:
Name Type Attributes Description
is_direct string <optional>

if 'origin' specified, returns original element even if actual drawing moved to some other place

Returns:

d3.select object for main element for drawing

Type
object

(protected) setDom(elem)

Assign painter to specified DOM element

Source:

Normally DOM element should be already assigned in constructor

Parameters:
Name Type Description
elem string | object

element ID or DOM Element

(protected) setTopPainter()

Set painter, stored in first child element

Source:

Only make sense after first drawing is completed and any child element add to configured DOM