diff --git a/library.htm b/library.htm index edf5106..9dde471 100644 --- a/library.htm +++ b/library.htm @@ -370,7 +370,10 @@ newDiagram = diagram.clone();
Creates a copy of the diagram. If options are given, they will override the
current diagram’s state (options is passed to the constructor of the new
-object, so all the same options are available).
+object, so all the same options are available). Note that by default, the
+namespace
will not be cloned (a new unique namespace will be
+generated). Also the container
will not be cloned; you will need
+to specify one explicitly or manually attach the new diagram at a later point.
process
can be provided.
--diagram.setHighlight(line); -diagram.setHighlight(); -- -
-Marks elements generated by the specified line with a "focus" CSS class, which
-can be used to style them. Only one line can be highlighted at a time. Calling
-with no parameter (or null
) will remove the highlighting.
-
@@ -537,6 +527,66 @@ node = diagram.dom(); Returns the base SVG element which the diagram has been rendered into. +.setHighlight
+ ++diagram.setHighlight(line); +diagram.setHighlight(); ++ ++Marks elements generated by the specified line with a "focus" CSS class, which +can be used to style them. Only one line can be highlighted at a time. Calling +with no parameter (or
+ +null
) will remove the highlighting. +.addEventListener
+ ++diagram.addEventListener(type, callback); ++ ++Registers an event listener. The available events are:
+
mouseover
: called when the mouse enters a region of the diagram
+(e.g. a note).mouseout
: called when the mouse leaves a region of the
+diagram.click
: called when the user clicks on a region of the
+diagram.mouseover
and click
are invoked with a single
+parameter: the element. This object contains:
ln
: the line number of the source code which defined the
+element.type
: a string representing the type of the element.+diagram.removeEventListener(type, callback); ++ +
+Removes a previously registered event listener. +
+ ++diagram.removeAllEventListeners(type); +diagram.removeAllEventListeners(); ++ +
+Removes all registered event listeners for a given type, or all event listeners +for all types. +
+