Objects - marcelklehr/buzzmap GitHub Wiki

When dealing with events, you may have noticed a node object being passed to some callbacks. These objects are for interacting with the nodes.

Node object

Here's a list of the important properties:

  • node.children An array of all child nodes of the particular node.
  • node.parent The parent node object.
  • node.el The jQuery object of the div container representing the node on the screen.
  • node.x The x-coordinate of the node.
  • node.y The y-coordinate of the node.
  • node.visible True when the node is visible.
  • node.editing True while the node is being edited.
  • node.dragging True while the node is being dragged.
  • node.obj The Buzzmap object.

Methods:

  • .toggleChildren() Toggle visibility of the child nodes.
  • .edit() Edit the node in the browser.
  • .removeNode() Removes the node.
  • .label([text]) Getter and setter for the node's label.

Buzzmap object

The Buzzmap object is returned by the jQuery method $().buzzmap().
These are the important properties:

  • obj.root The root node.
  • obj.nodes An array of all nodes.
  • obj.lines An array of all connecting lines.
  • obj.options The global options, initially set with .buzzmap(). Altering this will change behaviour of all nodes.
  • obj.canvas The Raphael paper object (svg property contains the svg element)

Methods:

  • .addNode(parentNode, label) Adds a node to the mindmap as a child of parentNode.
  • .seralize() Returns the structure of the mindmap serialized as a JSON string.
  • .animate() Start the animation.
  • .bind('onevent', callback) Register an event handler to listen for an event.
  • .unbind('onevent', callback) Remove a registered event handler.

See Events for a list of the available callbacks.