svgedit/docs/files/svgcanvas-js.html

220 lines
110 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>SvgCanvas</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version 1.4 -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="SvgCanvas"></a>SvgCanvas</h1><div class=CBody><p>The main SvgCanvas class that manages all SVG-related functions</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>container</td><td class=CDLDescription>The container HTML element that should hold the SVG root element</td></tr><tr><td class=CDLEntry>config</td><td class=CDLDescription>An object that contains configuration data</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#SvgCanvas" >SvgCanvas</a></td><td class=SDescription>The main SvgCanvas class that manages all SVG-related functions</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SvgCanvas.toXml" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">toXml</a></td><td class=SDescription>Converts characters in a string to XML-friendly entities.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SvgCanvas.fromXml" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">fromXml</a></td><td class=SDescription>Converts XML entities in a string to single characters. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SvgCanvas.Unit_conversion_functions" >Unit conversion functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.convertToNum" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">convertToNum</a></td><td class=SDescription>Converts given values to numbers. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.setUnitAttr" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">setUnitAttr</a></td><td class=SDescription>Sets an element&rsquo;s attribute based on the unit in its current value.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.isValidUnit" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">isValidUnit</a></td><td class=SDescription>Check if an attribute&rsquo;s value is in a valid format</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SvgCanvas.Undo/Redo_history_management" >Undo/<wbr>Redo history management</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.ChangeElementCommand" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">ChangeElementCommand</a></td><td class=SDescription>History command to make a change to an element. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.ChangeElementCommand.apply" >ChangeElementCommand.<wbr>apply</a></td><td class=SDescription>Performs the stored change action</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.ChangeElementCommand.unapply" >ChangeElementCommand.<wbr>unapply</a></td><td class=SDescription>Reverses the stored change action</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.ChangeElementCommand.elements" >ChangeElementCommand.<wbr>elements</a></td><td class=SDescription>Returns array with element associated with this command</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.InsertElementCommand" id=link7 onMouseOver="ShowTip(event, 'tt7', 'link7')" onMouseOut="HideTip('tt7')">InsertElementCommand</a></td><td class=SDescription>History command for an element that was added to the DOM</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.InsertElementCommand.apply" >InsertElementCommand.<wbr>apply</a></td><td class=SDescription>Re-Inserts the new element</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.InsertElementCommand.unapply" >InsertElementCommand.<wbr>unapply</a></td><td class=SDescription>Removes the element</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.InsertElementCommand.elements" >InsertElementCommand.<wbr>elements</a></td><td class=SDescription>Returns array with element associated with this command</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.RemoveElementCommand" id=link8 onMouseOver="ShowTip(event, 'tt8', 'link8')" onMouseOut="HideTip('tt8')">RemoveElementCommand</a></td><td class=SDescription>History command for an element removed from the DOM</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.RemoveElementCommand.apply" >RemoveElementCommand.<wbr>apply</a></td><td class=SDescription>Re-removes the new element</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.RemoveElementCommand.unapply" >RemoveElementCommand.<wbr>unapply</a></td><td class=SDescription>Re-adds the new element</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.RemoveElementCommand.elements" >RemoveElementCommand.<wbr>elements</a></td><td class=SDescription>Returns array with element associated with this command</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.MoveElementCommand" id=link9 onMouseOver="ShowTip(event, 'tt9', 'link9')" onMouseOut="HideTip('tt9')">MoveElementCommand</a></td><td class=SDescription>History command for an element that had its DOM position changed</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.MoveElementCommand.unapply" >MoveElementCommand.<wbr>unapply</a></td><td class=SDescription>Re-positions the element</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.MoveElementCommand.unapply" >MoveElementCommand.<wbr>unapply</a></td><td class=SDescription>Positions the element back to its original location</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.MoveElementCommand.elements" >MoveElementCommand.<wbr>elements</a></td><td class=SDescription>Returns array with element associated with this command</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.BatchCommand" id=link10 onMouseOver="ShowTip(event, 'tt10', 'link10')" onMouseOut="HideTip('tt10')">BatchCommand</a></td><td class=SDescription>History command that can contain/execute multiple other commands</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.BatchCommand.apply" >BatchCommand.<wbr>apply</a></td><td class=SDescription>Runs &ldquo;apply&rdquo; on all subcommands</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.BatchCommand.unapply" >BatchCommand.<wbr>unapply</a></td><td class=SDescription>Runs &ldquo;unapply&rdquo; on all subcommands</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.BatchCommand.elements" >BatchCommand.<wbr>elements</a></td><td class=SDescription>Iterate through all our subcommands and returns all the elements we are changing</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.BatchCommand.addSubCommand" >BatchCommand.<wbr>addSubCommand</a></td><td class=SDescription>Adds a given command to the history stack</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.BatchCommand.isEmpty" >BatchCommand.<wbr>isEmpty</a></td><td class=SDescription>Returns a boolean indicating whether or not the batch command is empty</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.resetUndoStack" id=link11 onMouseOver="ShowTip(event, 'tt11', 'link11')" onMouseOut="HideTip('tt11')">resetUndoStack</a></td><td class=SDescription>Resets the undo stack, effectively clearing the undo/redo history</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.undoMgr.getUndoStackSize" >undoMgr.<wbr>getUndoStackSize</a></td><td class=SDescription>Integer with the current size of the undo history stack</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.undoMgr.getRedoStackSize" >undoMgr.<wbr>getRedoStackSize</a></td><td class=SDescription>Integer with the current size of the redo history stack</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.undoMgr.getNextUndoCommandText" >undoMgr.<wbr>getNextUndoCommandText</a></td><td class=SDescription>String associated with the next undo command</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.undoMgr.getNextRedoCommandText" >undoMgr.<wbr>getNextRedoCommandText</a></td><td class=SDescription>String associated with the next redo command</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.undoMgr.undo" >undoMgr.undo</a></td><td class=SDescription>Performs an undo step</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.undoMgr.redo" >undoMgr.redo</a></td><td class=SDescription>Performs a redo step</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.addCommandToHistory" id=link12 onMouseOver="ShowTip(event, 'tt12', 'link12')" onMouseOut="HideTip('tt12')">addCommandToHistory</a></td><td class=SDescription>Adds a command object to the undo history stack</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SvgCanvas.beginUndoableChange" id=link13 onMouseOver="ShowTip(event, 'tt13', 'link13')" onMouseOut="HideTip('tt13')">beginUndoableChange</a></td><td class=SDescription>This function tells the canvas to remember the old values of the attrName attribute for each element sent in. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SvgCanvas.finishUndoableChange" id=link14 onMouseOver="ShowTip(event, 'tt14', 'link14')" onMouseOut="HideTip('tt14')">finishUndoableChange</a></td><td class=SDescription>This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called. </td></tr><tr class="SInterface"><td class=SEntry><a href="#Selector" >Selector</a></td><td class=SDescription>Private class for DOM element selection boxes</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#Selector.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#Selector.Selector.reset" >Selector.<wbr>reset</a></td><td class=SDescription>Used to reset the id and element that the selector is attached to</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#Selector.Selector.showGrips" >Selector.<wbr>showGrips</a></td><td class=SDescription>Show the resize grips of this selector</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#Selector.Selector.updateGripCursors" >Selector.<wbr>updateGripCursors</a></td><td class=SDescription>Updates cursors for corner grips on rotation so arrows point the right way</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#Selector.Selector.resize" >Selector.<wbr>resize</a></td><td class=SDescription>Updates the selector to match the element&rsquo;s size</td></tr><tr class="SInterface"><td class=SEntry><a href="#SelectorManager" >SelectorManager</a></td><td class=SDescription>Public class to manage all selector objects (selection boxes)</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.SelectorManager.initGroup" >SelectorManager.<wbr>initGroup</a></td><td class=SDescription>Resets the parent selector group element</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.SelectorManager.requestSelector" >SelectorManager.<wbr>requestSelector</a></td><td class=SDescription>Returns the selector based on the given element</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.SelectorManager.releaseSelector" >SelectorManager.<wbr>releaseSelector</a></td><td class=SDescription>Removes the selector of the given element (hides selection box)</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.SelectorManager.getRubberBandBox" >SelectorManager.<wbr>getRubberBandBox</a></td><td class=SDescription>Returns the rubberBandBox DOM element. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SelectorManager.Helper_functions" >Helper functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.assignAttributes" id=link15 onMouseOver="ShowTip(event, 'tt15', 'link15')" onMouseOut="HideTip('tt15')">assignAttributes</a></td><td class=SDescription>Assigns multiple attributes to an element.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.cleanupElement" id=link16 onMouseOver="ShowTip(event, 'tt16', 'link16')" onMouseOut="HideTip('tt16')">cleanupElement</a></td><td class=SDescription>Remove unneeded (default) attributes, makes resulting SVG smaller</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.addSvgElementFromJson" id=link17 onMouseOver="ShowTip(event, 'tt17', 'link17')" onMouseOut="HideTip('tt17')">addSvgElementFromJson</a></td><td class=SDescription>Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.getId" id=link18 onMouseOver="ShowTip(event, 'tt18', 'link18')" onMouseOut="HideTip('tt18')">getId</a></td><td class=SDescription>Returns the last created DOM element ID string</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.getNextId" id=link19 onMouseOver="ShowTip(event, 'tt19', 'link19')" onMouseOut="HideTip('tt19')">getNextId</a></td><td class=SDescription>Creates and returns a unique ID string for a DOM element</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.bind" id=link20 onMouseOver="ShowTip(event, 'tt20', 'link20')" onMouseOut="HideTip('tt20')">bind</a></td><td class=SDescription>Attaches a callback function to an event</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.setIdPrefix" id=link21 onMouseOver="ShowTip(event, 'tt21', 'link21')" onMouseOut="HideTip('tt21')">setIdPrefix</a></td><td class=SDescription>Changes the ID prefix to the given value</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.sanitizeSvg" id=link22 onMouseOver="ShowTip(event, 'tt22', 'link22')" onMouseOut="HideTip('tt22')">sanitizeSvg</a></td><td class=SDescription>Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.getUrlFromAttr" id=link23 onMouseOver="ShowTip(event, 'tt23', 'link23')" onMouseOut="HideTip('tt23')">getUrlFromAttr</a></td><td class=SDescription>i.e. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SelectorManager.Selection" >Selection</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.clearSelection" id=link24 onMouseOver="ShowTip(event, 'tt24', 'link24')" onMouseOut="HideTip('tt24')">clearSelection</a></td><td class=SDescription>Clears the selection. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.addToSelection" id=link25 onMouseOver="ShowTip(event, 'tt25', 'link25')" onMouseOut="HideTip('tt25')">addToSelection</a></td><td class=SDescription>Adds a list of elements to the selection. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.removeFromSelection" id=link26 onMouseOver="ShowTip(event, 'tt26', 'link26')" onMouseOut="HideTip('tt26')">removeFromSelection</a></td><td class=SDescription>Removes elements from the selection.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SelectorManager.Serialization" >Serialization</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.removeUnusedDefElems" id=link27 onMouseOver="ShowTip(event, 'tt27', 'link27')" onMouseOut="HideTip('tt27')">removeUnusedDefElems</a></td><td class=SDescription>Looks at DOM elements inside the &lt;defs&gt; to see if they are referred to, removes them from the DOM if they are not.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.svgCanvasToString" id=link28 onMouseOver="ShowTip(event, 'tt28', 'link28')" onMouseOut="HideTip('tt28')">svgCanvasToString</a></td><td class=SDescription>Main function to set up the SVG content for output</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.svgToString" id=link29 onMouseOver="ShowTip(event, 'tt29', 'link29')" onMouseOut="HideTip('tt29')">svgToString</a></td><td class=SDescription>Sub function ran on each SVG element to convert it to a string as desired</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.embedImage" id=link30 onMouseOver="ShowTip(event, 'tt30', 'link30')" onMouseOut="HideTip('tt30')">embedImage</a></td><td class=SDescription>Converts a given image file to a data URL when possible, then runs a given callback</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.save" id=link31 onMouseOver="ShowTip(event, 'tt31', 'link31')" onMouseOut="HideTip('tt31')">save</a></td><td class=SDescription>Serializes the current drawing into SVG XML text and returns it to the &lsquo;saved&rsquo; handler. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.getSvgString" id=link32 onMouseOver="ShowTip(event, 'tt32', 'link32')" onMouseOut="HideTip('tt32')">getSvgString</a></td><td class=SDescription>Returns the current drawing as raw SVG XML text.</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.setSvgString" id=link33 onMouseOver="ShowTip(event, 'tt33', 'link33')" onMouseOut="HideTip('tt33')">setSvgString</a></td><td class=SDescription>This function sets the current drawing as the input SVG XML.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.importSvgString" >importSvgString</a></td><td class=SDescription>This function imports the input SVG XML into the current layer in the drawing</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SelectorManager.Layers" >Layers</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.createLayer" id=link34 onMouseOver="ShowTip(event, 'tt34', 'link34')" onMouseOut="HideTip('tt34')">createLayer</a></td><td class=SDescription>Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the &lsquo;changed&rsquo; handler. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.deleteCurrentLayer" id=link35 onMouseOver="ShowTip(event, 'tt35', 'link35')" onMouseOut="HideTip('tt35')">deleteCurrentLayer</a></td><td class=SDescription>Deletes the current layer from the drawing and then clears the selection. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.getNumLayers" id=link36 onMouseOver="ShowTip(event, 'tt36', 'link36')" onMouseOut="HideTip('tt36')">getNumLayers</a></td><td class=SDescription>Returns the number of layers in the current drawing.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.getLayer" id=link37 onMouseOver="ShowTip(event, 'tt37', 'link37')" onMouseOut="HideTip('tt37')">getLayer</a></td><td class=SDescription>Returns the name of the ith layer. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.getCurrentLayer" id=link38 onMouseOver="ShowTip(event, 'tt38', 'link38')" onMouseOut="HideTip('tt38')">getCurrentLayer</a></td><td class=SDescription>Returns the name of the currently selected layer. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.setCurrentLayer" id=link39 onMouseOver="ShowTip(event, 'tt39', 'link39')" onMouseOut="HideTip('tt39')">setCurrentLayer</a></td><td class=SDescription>Sets the current layer. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.renameCurrentLayer" id=link40 onMouseOver="ShowTip(event, 'tt40', 'link40')" onMouseOut="HideTip('tt40')">renameCurrentLayer</a></td><td class=SDescription>Renames the current layer. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.setCurrentLayerPosition" id=link41 onMouseOver="ShowTip(event, 'tt41', 'link41')" onMouseOut="HideTip('tt41')">setCurrentLayerPosition</a></td><td class=SDescription>Changes the position of the current layer to the new value. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.getLayerVisibility" id=link42 onMouseOver="ShowTip(event, 'tt42', 'link42')" onMouseOut="HideTip('tt42')">getLayerVisibility</a></td><td class=SDescription>Returns whether the layer is visible. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.setLayerVisibility" id=link43 onMouseOver="ShowTip(event, 'tt43', 'link43')" onMouseOut="HideTip('tt43')">setLayerVisibility</a></td><td class=SDescription>Sets the visibility of the layer. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.moveSelectedToLayer" id=link44 onMouseOver="ShowTip(event, 'tt44', 'link44')" onMouseOut="HideTip('tt44')">moveSelectedToLayer</a></td><td class=SDescription>Moves the selected elements to layername. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.getLayerOpacity" id=link45 onMouseOver="ShowTip(event, 'tt45', 'link45')" onMouseOut="HideTip('tt45')">getLayerOpacity</a></td><td class=SDescription>Returns the opacity of the given layer. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.setLayerOpacity" id=link46 onMouseOver="ShowTip(event, 'tt46', 'link46')" onMouseOut="HideTip('tt46')">setLayerOpacity</a></td><td class=SDescription>Sets the opacity of the given layer. </td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#SelectorManager.selectAllInCurrentLayer" id=link47 onMouseOver="ShowTip(event, 'tt47', 'link47')" onMouseOut="HideTip('tt47')">selectAllInCurrentLayer</a></td><td class=SDescription>Clears the selection, then adds all elements in the current layer to the selection. </td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.clear" id=link48 onMouseOver="ShowTip(event, 'tt48', 'link48')" onMouseOut="HideTip('tt48')">clear</a></td><td class=SDescription>Clears the current document. </td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#SelectorManager.Fill_and_Stroke" >Fill and Stroke</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#SelectorManager.getVersion" id=link49 onMouseOver="ShowTip(event, 'tt49', 'link49')" onMouseOut="HideTip('tt49')">getVersion</a></td><td class=SDescription>Returns a string which describes the revision number of SvgCanvas.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.toXml"></a>toXml</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>toXml = function(</td><td class=PParameter nowrap>str</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Converts characters in a string to XML-friendly entities.</p><p>Example: &ldquo;&amp;&rdquo; becomes &ldquo;&amp;amp;&rdquo;</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>str</td><td class=CDLDescription>The string to be converted</td></tr></table><h4 class=CHeading>Returns</h4><p>The converted string</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.fromXml"></a>fromXml</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>fromXml = function(</td><td class=PParameter nowrap>str</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Converts XML entities in a string to single characters.&nbsp; Example: &ldquo;&amp;amp;&rdquo; becomes &ldquo;&amp;&rdquo;</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>str</td><td class=CDLDescription>The string to be converted</td></tr></table><h4 class=CHeading>Returns</h4><p>The converted string</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.Unit_conversion_functions"></a>Unit conversion functions</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.convertToNum"></a>convertToNum</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>convertToNum = function(</td><td class=PParameter nowrap>attr,</td></tr><tr><td></td><td class=PParameter nowrap>val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Converts given values to numbers.&nbsp; Attributes must be supplied in case a percentage is given</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>attr</td><td class=CDLDescription>String with the name of the attribute associated with the value</td></tr><tr><td class=CDLEntry>val</td><td class=CDLDescription>String with the attribute value to convert</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.setUnitAttr"></a>setUnitAttr</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>setUnitAttr = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>attr,</td></tr><tr><td></td><td class=PParameter nowrap>val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets an element&rsquo;s attribute based on the unit in its current value.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>DOM element to be changed</td></tr><tr><td class=CDLEntry>attr</td><td class=CDLDescription>String with the name of the attribute associated with the value</td></tr><tr><td class=CDLEntry>val</td><td class=CDLDescription>String with the attribute value to convert</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.isValidUnit"></a>isValidUnit</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>canvas.isValidUnit = function(</td><td class=PParameter nowrap>attr,</td></tr><tr><td></td><td class=PParameter nowrap>val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Check if an attribute&rsquo;s value is in a valid format</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>attr</td><td class=CDLDescription>String with the name of the attribute associated with the value</td></tr><tr><td class=CDLEntry>val</td><td class=CDLDescription>String with the attribute value to check</td></tr></table></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.Undo/Redo_history_management"></a>Undo/<wbr>Redo history management</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.ChangeElementCommand"></a>ChangeElementCommand</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var ChangeElementCommand = this.undoCmd.changeElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>attrs,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>History command to make a change to an element.&nbsp; Usually an attribute change, but can also be textcontent.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>The DOM element that was changed</td></tr><tr><td class=CDLEntry>attrs</td><td class=CDLDescription>An object with the attributes to be changed and the values they had <b>before</b> the change</td></tr><tr><td class=CDLEntry>text</td><td class=CDLDescription>An optional string visible to user related to this change</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.ChangeElementCommand.apply"></a>ChangeElementCommand.<wbr>apply</h3><div class=CBody><p>Performs the stored change action</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.ChangeElementCommand.unapply"></a>ChangeElementCommand.<wbr>unapply</h3><div class=CBody><p>Reverses the stored change action</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.ChangeElementCommand.elements"></a>ChangeElementCommand.<wbr>elements</h3><div class=CBody><p>Returns array with element associated with this command</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.InsertElementCommand"></a>InsertElementCommand</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var InsertElementCommand = this.undoCmd.insertElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>History command for an element that was added to the DOM</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>The newly added DOM element</td></tr><tr><td class=CDLEntry>text</td><td class=CDLDescription>An optional string visible to user related to this change</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.InsertElementCommand.apply"></a>InsertElementCommand.<wbr>apply</h3><div class=CBody><p>Re-Inserts the new element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.InsertElementCommand.unapply"></a>InsertElementCommand.<wbr>unapply</h3><div class=CBody><p>Removes the element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.InsertElementCommand.elements"></a>InsertElementCommand.<wbr>elements</h3><div class=CBody><p>Returns array with element associated with this command</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.RemoveElementCommand"></a>RemoveElementCommand</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var RemoveElementCommand = this.undoCmd.removeElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>parent,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>History command for an element removed from the DOM</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>The removed DOM element</td></tr><tr><td class=CDLEntry>parent</td><td class=CDLDescription>The DOM element&rsquo;s parent</td></tr><tr><td class=CDLEntry>text</td><td class=CDLDescription>An optional string visible to user related to this change</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.RemoveElementCommand.apply"></a>RemoveElementCommand.<wbr>apply</h3><div class=CBody><p>Re-removes the new element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.RemoveElementCommand.unapply"></a>RemoveElementCommand.<wbr>unapply</h3><div class=CBody><p>Re-adds the new element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.RemoveElementCommand.elements"></a>RemoveElementCommand.<wbr>elements</h3><div class=CBody><p>Returns array with element associated with this command</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.MoveElementCommand"></a>MoveElementCommand</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var MoveElementCommand = this.undoCmd.moveElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>oldNextSibling,</td></tr><tr><td></td><td class=PParameter nowrap>oldParent,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>History command for an element that had its DOM position changed</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>The DOM element that was moved</td></tr><tr><td class=CDLEntry>oldNextSibling</td><td class=CDLDescription>The element&rsquo;s next sibling before it was moved</td></tr><tr><td class=CDLEntry>oldParent</td><td class=CDLDescription>The element&rsquo;s parent before it was moved</td></tr><tr><td class=CDLEntry>text</td><td class=CDLDescription>An optional string visible to user related to this change</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.MoveElementCommand.unapply"></a>MoveElementCommand.<wbr>unapply</h3><div class=CBody><p>Re-positions the element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.MoveElementCommand.unapply"></a>MoveElementCommand.<wbr>unapply</h3><div class=CBody><p>Positions the element back to its original location</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.MoveElementCommand.elements"></a>MoveElementCommand.<wbr>elements</h3><div class=CBody><p>Returns array with element associated with this command</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.BatchCommand"></a>BatchCommand</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var BatchCommand = this.undoCmd.batch = function(</td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>History command that can contain/execute multiple other commands</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>text</td><td class=CDLDescription>An optional string visible to user related to this change</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.BatchCommand.apply"></a>BatchCommand.<wbr>apply</h3><div class=CBody><p>Runs &ldquo;apply&rdquo; on all subcommands</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.BatchCommand.unapply"></a>BatchCommand.<wbr>unapply</h3><div class=CBody><p>Runs &ldquo;unapply&rdquo; on all subcommands</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.BatchCommand.elements"></a>BatchCommand.<wbr>elements</h3><div class=CBody><p>Iterate through all our subcommands and returns all the elements we are changing</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.BatchCommand.addSubCommand"></a>BatchCommand.<wbr>addSubCommand</h3><div class=CBody><p>Adds a given command to the history stack</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>cmd</td><td class=CDLDescription>The undo command object to add</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.BatchCommand.isEmpty"></a>BatchCommand.<wbr>isEmpty</h3><div class=CBody><p>Returns a boolean indicating whether or not the batch command is empty</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.resetUndoStack"></a>resetUndoStack</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>resetUndoStack = function()</td></tr></table></blockquote><p>Resets the undo stack, effectively clearing the undo/redo history</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.undoMgr.getUndoStackSize"></a>undoMgr.<wbr>getUndoStackSize</h3><div class=CBody><h4 class=CHeading>Returns</h4><p>Integer with the current size of the undo history stack</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.undoMgr.getRedoStackSize"></a>undoMgr.<wbr>getRedoStackSize</h3><div class=CBody><h4 class=CHeading>Returns</h4><p>Integer with the current size of the redo history stack</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.undoMgr.getNextUndoCommandText"></a>undoMgr.<wbr>getNextUndoCommandText</h3><div class=CBody><h4 class=CHeading>Returns</h4><p>String associated with the next undo command</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.undoMgr.getNextRedoCommandText"></a>undoMgr.<wbr>getNextRedoCommandText</h3><div class=CBody><h4 class=CHeading>Returns</h4><p>String associated with the next redo command</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.undoMgr.undo"></a>undoMgr.undo</h3><div class=CBody><p>Performs an undo step</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.undoMgr.redo"></a>undoMgr.redo</h3><div class=CBody><p>Performs a redo step</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.addCommandToHistory"></a>addCommandToHistory</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>addCommandToHistory = c.undoCmd.add = function(</td><td class=PParameter nowrap>cmd</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds a command object to the undo history stack</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>cmd</td><td class=CDLDescription>The command object to add</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.beginUndoableChange"></a>beginUndoableChange</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>c.beginUndoableChange = function(</td><td class=PParameter nowrap>attrName,</td></tr><tr><td></td><td class=PParameter nowrap>elems</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>This function tells the canvas to remember the old values of the attrName attribute for each element sent in.&nbsp; The elements and values are stored on a stack, so the next call to finishUndoableChange() will pop the elements and old values off the stack, gets the current values from the DOM and uses all of these to construct the undo-able command.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>attrName</td><td class=CDLDescription>The name of the attribute being changed</td></tr><tr><td class=CDLEntry>elems</td><td class=CDLDescription>Array of DOM elements being changed</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SvgCanvas.finishUndoableChange"></a>finishUndoableChange</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>c.finishUndoableChange = function()</td></tr></table></blockquote><p>This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called.&nbsp; The command can then be added to the command history</p><h4 class=CHeading>Returns</h4><p>Batch command object with resulting changes</p></div></div></div>
<div class="CInterface"><div class=CTopic><h2 class=CTitle><a name="Selector"></a>Selector</h2><div class=CBody><p>Private class for DOM element selection boxes</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>id</td><td class=CDLDescription>integer to internally indentify the selector</td></tr><tr><td class=CDLEntry>elem</td><td class=CDLDescription>DOM element associated with this selector</td></tr></table><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SGroup"><td class=SEntry><a href="#Selector.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#Selector.Selector.reset" >Selector.<wbr>reset</a></td><td class=SDescription>Used to reset the id and element that the selector is attached to</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#Selector.Selector.showGrips" >Selector.<wbr>showGrips</a></td><td class=SDescription>Show the resize grips of this selector</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#Selector.Selector.updateGripCursors" >Selector.<wbr>updateGripCursors</a></td><td class=SDescription>Updates cursors for corner grips on rotation so arrows point the right way</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#Selector.Selector.resize" >Selector.<wbr>resize</a></td><td class=SDescription>Updates the selector to match the element&rsquo;s size</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="Selector.Functions"></a>Functions</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="Selector.Selector.reset"></a>Selector.<wbr>reset</h3><div class=CBody><p>Used to reset the id and element that the selector is attached to</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>e</td><td class=CDLDescription>DOM element associated with this selector</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="Selector.Selector.showGrips"></a>Selector.<wbr>showGrips</h3><div class=CBody><p>Show the resize grips of this selector</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>show</td><td class=CDLDescription>boolean indicating whether grips should be shown or not</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="Selector.Selector.updateGripCursors"></a>Selector.<wbr>updateGripCursors</h3><div class=CBody><p>Updates cursors for corner grips on rotation so arrows point the right way</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>angle</td><td class=CDLDescription>Float indicating current rotation angle in degrees</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="Selector.Selector.resize"></a>Selector.<wbr>resize</h3><div class=CBody><p>Updates the selector to match the element&rsquo;s size</p></div></div></div>
<div class="CInterface"><div class=CTopic><h2 class=CTitle><a name="SelectorManager"></a>SelectorManager</h2><div class=CBody><p>Public class to manage all selector objects (selection boxes)</p><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SFunction"><td class=SEntry><a href="#SelectorManager.SelectorManager.initGroup" >SelectorManager.<wbr>initGroup</a></td><td class=SDescription>Resets the parent selector group element</td></tr><tr class="SFunction SMarked"><td class=SEntry><a href="#SelectorManager.SelectorManager.requestSelector" >SelectorManager.<wbr>requestSelector</a></td><td class=SDescription>Returns the selector based on the given element</td></tr><tr class="SFunction"><td class=SEntry><a href="#SelectorManager.SelectorManager.releaseSelector" >SelectorManager.<wbr>releaseSelector</a></td><td class=SDescription>Removes the selector of the given element (hides selection box)</td></tr><tr class="SFunction SMarked"><td class=SEntry><a href="#SelectorManager.SelectorManager.getRubberBandBox" >SelectorManager.<wbr>getRubberBandBox</a></td><td class=SDescription>Returns the rubberBandBox DOM element. </td></tr><tr class="SGroup"><td class=SEntry><a href="#SelectorManager.Helper_functions" >Helper functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.assignAttributes" id=link50 onMouseOver="ShowTip(event, 'tt15', 'link50')" onMouseOut="HideTip('tt15')">assignAttributes</a></td><td class=SDescription>Assigns multiple attributes to an element.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.cleanupElement" id=link51 onMouseOver="ShowTip(event, 'tt16', 'link51')" onMouseOut="HideTip('tt16')">cleanupElement</a></td><td class=SDescription>Remove unneeded (default) attributes, makes resulting SVG smaller</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.addSvgElementFromJson" id=link52 onMouseOver="ShowTip(event, 'tt17', 'link52')" onMouseOut="HideTip('tt17')">addSvgElementFromJson</a></td><td class=SDescription>Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.getId" id=link53 onMouseOver="ShowTip(event, 'tt18', 'link53')" onMouseOut="HideTip('tt18')">getId</a></td><td class=SDescription>Returns the last created DOM element ID string</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.getNextId" id=link54 onMouseOver="ShowTip(event, 'tt19', 'link54')" onMouseOut="HideTip('tt19')">getNextId</a></td><td class=SDescription>Creates and returns a unique ID string for a DOM element</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.bind" id=link55 onMouseOver="ShowTip(event, 'tt20', 'link55')" onMouseOut="HideTip('tt20')">bind</a></td><td class=SDescription>Attaches a callback function to an event</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.setIdPrefix" id=link56 onMouseOver="ShowTip(event, 'tt21', 'link56')" onMouseOut="HideTip('tt21')">setIdPrefix</a></td><td class=SDescription>Changes the ID prefix to the given value</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.sanitizeSvg" id=link57 onMouseOver="ShowTip(event, 'tt22', 'link57')" onMouseOut="HideTip('tt22')">sanitizeSvg</a></td><td class=SDescription>Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.getUrlFromAttr" id=link58 onMouseOver="ShowTip(event, 'tt23', 'link58')" onMouseOut="HideTip('tt23')">getUrlFromAttr</a></td><td class=SDescription>i.e. </td></tr><tr class="SGroup"><td class=SEntry><a href="#SelectorManager.Selection" >Selection</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.clearSelection" id=link59 onMouseOver="ShowTip(event, 'tt24', 'link59')" onMouseOut="HideTip('tt24')">clearSelection</a></td><td class=SDescription>Clears the selection. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.addToSelection" id=link60 onMouseOver="ShowTip(event, 'tt25', 'link60')" onMouseOut="HideTip('tt25')">addToSelection</a></td><td class=SDescription>Adds a list of elements to the selection. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.removeFromSelection" id=link61 onMouseOver="ShowTip(event, 'tt26', 'link61')" onMouseOut="HideTip('tt26')">removeFromSelection</a></td><td class=SDescription>Removes elements from the selection.</td></tr><tr class="SGroup"><td class=SEntry><a href="#SelectorManager.Serialization" >Serialization</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.removeUnusedDefElems" id=link62 onMouseOver="ShowTip(event, 'tt27', 'link62')" onMouseOut="HideTip('tt27')">removeUnusedDefElems</a></td><td class=SDescription>Looks at DOM elements inside the &lt;defs&gt; to see if they are referred to, removes them from the DOM if they are not.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.svgCanvasToString" id=link63 onMouseOver="ShowTip(event, 'tt28', 'link63')" onMouseOut="HideTip('tt28')">svgCanvasToString</a></td><td class=SDescription>Main function to set up the SVG content for output</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.svgToString" id=link64 onMouseOver="ShowTip(event, 'tt29', 'link64')" onMouseOut="HideTip('tt29')">svgToString</a></td><td class=SDescription>Sub function ran on each SVG element to convert it to a string as desired</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.embedImage" id=link65 onMouseOver="ShowTip(event, 'tt30', 'link65')" onMouseOut="HideTip('tt30')">embedImage</a></td><td class=SDescription>Converts a given image file to a data URL when possible, then runs a given callback</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.save" id=link66 onMouseOver="ShowTip(event, 'tt31', 'link66')" onMouseOut="HideTip('tt31')">save</a></td><td class=SDescription>Serializes the current drawing into SVG XML text and returns it to the &lsquo;saved&rsquo; handler. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.getSvgString" id=link67 onMouseOver="ShowTip(event, 'tt32', 'link67')" onMouseOut="HideTip('tt32')">getSvgString</a></td><td class=SDescription>Returns the current drawing as raw SVG XML text.</td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.setSvgString" id=link68 onMouseOver="ShowTip(event, 'tt33', 'link68')" onMouseOut="HideTip('tt33')">setSvgString</a></td><td class=SDescription>This function sets the current drawing as the input SVG XML.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.importSvgString" >importSvgString</a></td><td class=SDescription>This function imports the input SVG XML into the current layer in the drawing</td></tr><tr class="SGroup"><td class=SEntry><a href="#SelectorManager.Layers" >Layers</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.createLayer" id=link69 onMouseOver="ShowTip(event, 'tt34', 'link69')" onMouseOut="HideTip('tt34')">createLayer</a></td><td class=SDescription>Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the &lsquo;changed&rsquo; handler. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.deleteCurrentLayer" id=link70 onMouseOver="ShowTip(event, 'tt35', 'link70')" onMouseOut="HideTip('tt35')">deleteCurrentLayer</a></td><td class=SDescription>Deletes the current layer from the drawing and then clears the selection. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.getNumLayers" id=link71 onMouseOver="ShowTip(event, 'tt36', 'link71')" onMouseOut="HideTip('tt36')">getNumLayers</a></td><td class=SDescription>Returns the number of layers in the current drawing.</td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.getLayer" id=link72 onMouseOver="ShowTip(event, 'tt37', 'link72')" onMouseOut="HideTip('tt37')">getLayer</a></td><td class=SDescription>Returns the name of the ith layer. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.getCurrentLayer" id=link73 onMouseOver="ShowTip(event, 'tt38', 'link73')" onMouseOut="HideTip('tt38')">getCurrentLayer</a></td><td class=SDescription>Returns the name of the currently selected layer. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.setCurrentLayer" id=link74 onMouseOver="ShowTip(event, 'tt39', 'link74')" onMouseOut="HideTip('tt39')">setCurrentLayer</a></td><td class=SDescription>Sets the current layer. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.renameCurrentLayer" id=link75 onMouseOver="ShowTip(event, 'tt40', 'link75')" onMouseOut="HideTip('tt40')">renameCurrentLayer</a></td><td class=SDescription>Renames the current layer. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.setCurrentLayerPosition" id=link76 onMouseOver="ShowTip(event, 'tt41', 'link76')" onMouseOut="HideTip('tt41')">setCurrentLayerPosition</a></td><td class=SDescription>Changes the position of the current layer to the new value. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.getLayerVisibility" id=link77 onMouseOver="ShowTip(event, 'tt42', 'link77')" onMouseOut="HideTip('tt42')">getLayerVisibility</a></td><td class=SDescription>Returns whether the layer is visible. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.setLayerVisibility" id=link78 onMouseOver="ShowTip(event, 'tt43', 'link78')" onMouseOut="HideTip('tt43')">setLayerVisibility</a></td><td class=SDescription>Sets the visibility of the layer. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.moveSelectedToLayer" id=link79 onMouseOver="ShowTip(event, 'tt44', 'link79')" onMouseOut="HideTip('tt44')">moveSelectedToLayer</a></td><td class=SDescription>Moves the selected elements to layername. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.getLayerOpacity" id=link80 onMouseOver="ShowTip(event, 'tt45', 'link80')" onMouseOut="HideTip('tt45')">getLayerOpacity</a></td><td class=SDescription>Returns the opacity of the given layer. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.setLayerOpacity" id=link81 onMouseOver="ShowTip(event, 'tt46', 'link81')" onMouseOut="HideTip('tt46')">setLayerOpacity</a></td><td class=SDescription>Sets the opacity of the given layer. </td></tr><tr class="SFunction SIndent1"><td class=SEntry><a href="#SelectorManager.selectAllInCurrentLayer" id=link82 onMouseOver="ShowTip(event, 'tt47', 'link82')" onMouseOut="HideTip('tt47')">selectAllInCurrentLayer</a></td><td class=SDescription>Clears the selection, then adds all elements in the current layer to the selection. </td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.clear" id=link83 onMouseOver="ShowTip(event, 'tt48', 'link83')" onMouseOut="HideTip('tt48')">clear</a></td><td class=SDescription>Clears the current document. </td></tr><tr class="SGroup"><td class=SEntry><a href="#SelectorManager.Fill_and_Stroke" >Fill and Stroke</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent1 SMarked"><td class=SEntry><a href="#SelectorManager.getVersion" id=link84 onMouseOver="ShowTip(event, 'tt49', 'link84')" onMouseOut="HideTip('tt49')">getVersion</a></td><td class=SDescription>Returns a string which describes the revision number of SvgCanvas.</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.SelectorManager.initGroup"></a>SelectorManager.<wbr>initGroup</h3><div class=CBody><p>Resets the parent selector group element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.SelectorManager.requestSelector"></a>SelectorManager.<wbr>requestSelector</h3><div class=CBody><p>Returns the selector based on the given element</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>DOM element to get the selector for</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.SelectorManager.releaseSelector"></a>SelectorManager.<wbr>releaseSelector</h3><div class=CBody><p>Removes the selector of the given element (hides selection box)</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>DOM element to remove the selector for</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.SelectorManager.getRubberBandBox"></a>SelectorManager.<wbr>getRubberBandBox</h3><div class=CBody><p>Returns the rubberBandBox DOM element.&nbsp; This is the rectangle drawn by the user for selecting/zooming</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.Helper_functions"></a>Helper functions</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.assignAttributes"></a>assignAttributes</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var assignAttributes = this.assignAttributes = function(</td><td class=PParameter nowrap>node,</td></tr><tr><td></td><td class=PParameter nowrap>attrs,</td></tr><tr><td></td><td class=PParameter nowrap>suspendLength,</td></tr><tr><td></td><td class=PParameter nowrap>unitCheck</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Assigns multiple attributes to an element.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>DOM element to apply new attribute values to</td></tr><tr><td class=CDLEntry>attrs</td><td class=CDLDescription>Object with attribute keys/values</td></tr><tr><td class=CDLEntry>suspendLength</td><td class=CDLDescription>Optional integer of milliseconds to suspend redraw</td></tr><tr><td class=CDLEntry>unitCheck</td><td class=CDLDescription>Boolean to indicate the need to use setUnitAttr</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.cleanupElement"></a>cleanupElement</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var cleanupElement = this.cleanupElement = function(</td><td class=PParameter nowrap>element</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Remove unneeded (default) attributes, makes resulting SVG smaller</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>element</td><td class=CDLDescription>DOM element to clean up</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.addSvgElementFromJson"></a>addSvgElementFromJson</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var addSvgElementFromJson = this.addSvgElementFromJson = function(</td><td class=PParameter nowrap>data</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>data</td><td class=CDLDescription>Object with the following keys/values:</td></tr></table><ul><li>element - DOM element to create</li><li>attr - Object with attributes/values to assign to the new element</li><li>curStyles - Boolean indicating that current style attributes should be applied first</li></ul><p>Returns: The new element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getId"></a>getId</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>getId = c.getId = function()</td></tr></table></blockquote><p>Returns the last created DOM element ID string</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getNextId"></a>getNextId</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>getNextId = c.getNextId = function()</td></tr></table></blockquote><p>Creates and returns a unique ID string for a DOM element</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.bind"></a>bind</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>c.bind = function(</td><td class=PParameter nowrap>event,</td></tr><tr><td></td><td class=PParameter nowrap>f</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Attaches a callback function to an event</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>event</td><td class=CDLDescription>String indicating the name of the event</td></tr><tr><td class=CDLEntry>f</td><td class=CDLDescription>The callback function to bind to the event</td></tr></table><h4 class=CHeading>Return</h4><p>The previous event</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.setIdPrefix"></a>setIdPrefix</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>c.setIdPrefix = function(</td><td class=PParameter nowrap>p</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Changes the ID prefix to the given value</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>p</td><td class=CDLDescription>String with the new prefix</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.sanitizeSvg"></a>sanitizeSvg</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var sanitizeSvg = this.sanitizeSvg = function(</td><td class=PParameter nowrap>node</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>node</td><td class=CDLDescription>The DOM element to be checked, will also check its children</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getUrlFromAttr"></a>getUrlFromAttr</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var getUrlFromAttr = this.getUrlFromAttr = function(</td><td class=PParameter nowrap>attrVal</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><h4 class=CHeading>Extracts the URL from the url(...) syntax of some attributes.&nbsp; Three variants</h4><p>i.e.&nbsp; &lt;circle fill=&rdquo;url(someFile.svg#foo)&rdquo; /&gt; or &lt;circle fill=&rdquo;url(&lsquo;someFile.svg#foo&rsquo;)&rdquo; /&gt; or &lt;circle fill=&rsquo;url(&ldquo;someFile.svg#foo&rdquo;)&rsquo; /&gt;</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>attrVal</td><td class=CDLDescription>The attribute value as a string</td></tr></table><h4 class=CHeading>Returns</h4><p>String with just the URL</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.Selection"></a>Selection</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.clearSelection"></a>clearSelection</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.clearSelection = function(</td><td class=PParameter nowrap>noCall</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Clears the selection.&nbsp; The &lsquo;selected&rsquo; handler is then called.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.addToSelection"></a>addToSelection</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.addToSelection = function(</td><td class=PParameter nowrap>elemsToAdd,</td></tr><tr><td></td><td class=PParameter nowrap>showGrips</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Adds a list of elements to the selection.&nbsp; The &lsquo;selected&rsquo; handler is then called.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elemsToAdd</td><td class=CDLDescription>an array of DOM elements to add to the selection</td></tr><tr><td class=CDLEntry>showGrips</td><td class=CDLDescription>a boolean flag indicating whether the resize grips should be shown</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.removeFromSelection"></a>removeFromSelection</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.removeFromSelection = function(</td><td class=PParameter nowrap>elemsToRemove</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Removes elements from the selection.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elemsToRemove</td><td class=CDLDescription>an array of elements to remove from selection</td></tr></table></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.Serialization"></a>Serialization</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.removeUnusedDefElems"></a>removeUnusedDefElems</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>var removeUnusedDefElems = this.removeUnusedDefElems = function()</td></tr></table></blockquote><p>Looks at DOM elements inside the &lt;defs&gt; to see if they are referred to, removes them from the DOM if they are not.</p><h4 class=CHeading>Returns</h4><p>The amount of elements that were removed</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.svgCanvasToString"></a>svgCanvasToString</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>var svgCanvasToString = this.svgCanvasToString = function()</td></tr></table></blockquote><p>Main function to set up the SVG content for output</p><h4 class=CHeading>Returns</h4><p>String containing the SVG image for output</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.svgToString"></a>svgToString</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var svgToString = this.svgToString = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>indent</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sub function ran on each SVG element to convert it to a string as desired</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>elem</td><td class=CDLDescription>The SVG element to convert</td></tr><tr><td class=CDLEntry>indent</td><td class=CDLDescription>Integer with the amount of spaces to indent this tag</td></tr></table><h4 class=CHeading>Returns</h4><p>String with the given element as an SVG tag</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.embedImage"></a>embedImage</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.embedImage = function(</td><td class=PParameter nowrap>val,</td></tr><tr><td></td><td class=PParameter nowrap>callback</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Converts a given image file to a data URL when possible, then runs a given callback</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>val</td><td class=CDLDescription>String with the path/URL of the image</td></tr><tr><td class=CDLEntry>callback</td><td class=CDLDescription>Optional function to run when image data is found, supplies the result (data URL or false) as first parameter.</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.save"></a>save</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.save = function(</td><td class=PParameter nowrap>opts</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Serializes the current drawing into SVG XML text and returns it to the &lsquo;saved&rsquo; handler.&nbsp; This function also includes the XML prolog.&nbsp; Clients of the SvgCanvas bind their save function to the &lsquo;saved&rsquo; event.</p><h4 class=CHeading>Returns</h4><p>Nothing</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getSvgString"></a>getSvgString</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getSvgString = function()</td></tr></table></blockquote><p>Returns the current drawing as raw SVG XML text.</p><h4 class=CHeading>Returns</h4><p>The current drawing as raw SVG XML text.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.setSvgString"></a>setSvgString</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setSvgString = function(</td><td class=PParameter nowrap>xmlString</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>This function sets the current drawing as the input SVG XML.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>xmlString</td><td class=CDLDescription>The SVG as XML text.</td></tr></table><h4 class=CHeading>Returns</h4><p>This function returns false if the set was unsuccessful, true otherwise.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.importSvgString"></a>importSvgString</h3><div class=CBody><p>This function imports the input SVG XML into the current layer in the drawing</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>xmlString</td><td class=CDLDescription>The SVG as XML text.</td></tr></table><h4 class=CHeading>Returns</h4><p>This function returns false if the import was unsuccessful, true otherwise.</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.Layers"></a>Layers</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.createLayer"></a>createLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.createLayer = function(</td><td class=PParameter nowrap>name</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the &lsquo;changed&rsquo; handler.&nbsp; This is an undoable action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>name</td><td class=CDLDescription>The given name</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.deleteCurrentLayer"></a>deleteCurrentLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.deleteCurrentLayer = function()</td></tr></table></blockquote><p>Deletes the current layer from the drawing and then clears the selection.&nbsp; This function then calls the &lsquo;changed&rsquo; handler.&nbsp; This is an undoable action.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getNumLayers"></a>getNumLayers</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getNumLayers = function()</td></tr></table></blockquote><p>Returns the number of layers in the current drawing.</p><h4 class=CHeading>Returns</h4><p>The number of layers in the current drawing.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getLayer"></a>getLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.getLayer = function(</td><td class=PParameter nowrap>i</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the name of the ith layer.&nbsp; If the index is out of range, an empty string is returned.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>i</td><td class=CDLDescription>the zero-based index of the layer you are querying.</td></tr></table><h4 class=CHeading>Returns</h4><p>The name of the ith layer</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getCurrentLayer"></a>getCurrentLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getCurrentLayer = function()</td></tr></table></blockquote><p>Returns the name of the currently selected layer.&nbsp; If an error occurs, an empty string is returned.</p><h4 class=CHeading>Returns</h4><p>The name of the currently active layer.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.setCurrentLayer"></a>setCurrentLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setCurrentLayer = function(</td><td class=PParameter nowrap>name</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the current layer.&nbsp; If the name is not a valid layer name, then this function returns false.&nbsp; Otherwise it returns true.&nbsp; This is not an undo-able action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>name</td><td class=CDLDescription>the name of the layer you want to switch to.</td></tr></table><h4 class=CHeading>Returns</h4><p>true if the current layer was switched, otherwise false</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.renameCurrentLayer"></a>renameCurrentLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.renameCurrentLayer = function(</td><td class=PParameter nowrap>newname</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Renames the current layer.&nbsp; If the layer name is not valid (i.e. unique), then this function does nothing and returns false, otherwise it returns true.&nbsp; This is an undo-able action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>newname</td><td class=CDLDescription>the new name you want to give the current layer.&nbsp; This name must be unique among all layer names.</td></tr></table><h4 class=CHeading>Returns</h4><p>true if the rename succeeded, false otherwise.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.setCurrentLayerPosition"></a>setCurrentLayerPosition</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setCurrentLayerPosition = function(</td><td class=PParameter nowrap>newpos</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Changes the position of the current layer to the new value.&nbsp; If the new index is not valid, this function does nothing and returns false, otherwise it returns true.&nbsp; This is an undo-able action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>newpos</td><td class=CDLDescription>The zero-based index of the new position of the layer.&nbsp; This should be between</td></tr><tr><td class=CDLEntry>0 and (number of layers</td><td class=CDLDescription>1)</td></tr></table><h4 class=CHeading>Returns</h4><p>true if the current layer position was changed, false otherwise.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getLayerVisibility"></a>getLayerVisibility</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.getLayerVisibility = function(</td><td class=PParameter nowrap>layername</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns whether the layer is visible.&nbsp; If the layer name is not valid, then this function returns false.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>layername</td><td class=CDLDescription>the name of the layer which you want to query.</td></tr></table><h4 class=CHeading>Returns</h4><p>The visibility state of the layer, or false if the layer name was invalid.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.setLayerVisibility"></a>setLayerVisibility</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setLayerVisibility = function(</td><td class=PParameter nowrap>layername,</td></tr><tr><td></td><td class=PParameter nowrap>bVisible</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the visibility of the layer.&nbsp; If the layer name is not valid, this function return false, otherwise it returns true.&nbsp; This is an undo-able action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>layername</td><td class=CDLDescription>the name of the layer to change the visibility</td></tr><tr><td class=CDLEntry>bVisible</td><td class=CDLDescription>true/false, whether the layer should be visible</td></tr></table><h4 class=CHeading>Returns</h4><p>true if the layer&rsquo;s visibility was set, false otherwise</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.moveSelectedToLayer"></a>moveSelectedToLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.moveSelectedToLayer = function(</td><td class=PParameter nowrap>layername</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Moves the selected elements to layername.&nbsp; If the name is not a valid layer name, then false is returned.&nbsp; Otherwise it returns true.&nbsp; This is an undo-able action.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>layername</td><td class=CDLDescription>the name of the layer you want to which you want to move the selected elements</td></tr></table><h4 class=CHeading>Returns</h4><p>true if the selected elements were moved to the layer, false otherwise.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getLayerOpacity"></a>getLayerOpacity</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.getLayerOpacity = function(</td><td class=PParameter nowrap>layername</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the opacity of the given layer.&nbsp; If the input name is not a layer, null is returned.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>layername</td><td class=CDLDescription>name of the layer on which to get the opacity</td></tr></table><h4 class=CHeading>Returns</h4><p>The opacity value of the given layer.&nbsp; This will be a value between 0.0 and 1.0, or null if layername is not a valid layer</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.setLayerOpacity"></a>setLayerOpacity</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setLayerOpacity = function(</td><td class=PParameter nowrap>layername,</td></tr><tr><td></td><td class=PParameter nowrap>opacity</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the opacity of the given layer.&nbsp; If the input name is not a layer, nothing happens.&nbsp; This is not an undo-able action.&nbsp; NOTE: this function exists solely to apply a highlighting/de-emphasis effect to a layer, when it is possible for a user to affect the opacity of a layer, we will need to allow this function to produce an undo-able action.&nbsp; If opacity is not a value between 0.0 and 1.0, then nothing happens.</p><h4 class=CHeading>Parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>layername</td><td class=CDLDescription>name of the layer on which to set the opacity</td></tr><tr><td class=CDLEntry>opacity</td><td class=CDLDescription>a float value in the range 0.0-1.0</td></tr></table></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.selectAllInCurrentLayer"></a>selectAllInCurrentLayer</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.selectAllInCurrentLayer = function()</td></tr></table></blockquote><p>Clears the selection, then adds all elements in the current layer to the selection.&nbsp; This function then fires the selected event.</p></div></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.clear"></a>clear</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.clear = function()</td></tr></table></blockquote><p>Clears the current document.&nbsp; This is not an undoable action.</p></div></div></div>
<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.Fill_and_Stroke"></a>Fill and Stroke</h3></div></div>
<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="SelectorManager.getVersion"></a>getVersion</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getVersion = function()</td></tr></table></blockquote><p>Returns a string which describes the revision number of SvgCanvas.</p></div></div></div>
</div><!--Content-->
<div id=Footer><a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Menu><div class=MEntry><div class=MFile><a href="extensions/ext-foreignobject-js.html">setForeignString(xmlString, elt)</a></div></div><div class=MEntry><div class=MFile id=MSelected>SvgCanvas</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Index</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Interfaces.html">Interfaces</a></div></div></div></div></div><script type="text/javascript"><!--
var searchPanel = new SearchPanel("searchPanel", "HTML", "../search");
--></script><div id=MSearchPanel class=MSearchPanelInactive><input type=text id=MSearchField value=Search onFocus="searchPanel.OnSearchFieldFocus(true)" onBlur="searchPanel.OnSearchFieldFocus(false)" onKeyUp="searchPanel.OnSearchFieldChange()"><select id=MSearchType onFocus="searchPanel.OnSearchTypeFocus(true)" onBlur="searchPanel.OnSearchTypeFocus(false)" onChange="searchPanel.OnSearchTypeChange()"><option id=MSearchEverything selected value="General">Everything</option><option value="Classes">Classes</option><option value="Functions">Functions</option><option value="Interfaces">Interfaces</option></select></div></div><!--Menu-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>toXml = function(</td><td class=PParameter nowrap>str</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Converts characters in a string to XML-friendly entities.</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>fromXml = function(</td><td class=PParameter nowrap>str</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Converts XML entities in a string to single characters. </div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>convertToNum = function(</td><td class=PParameter nowrap>attr,</td></tr><tr><td></td><td class=PParameter nowrap>val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Converts given values to numbers. </div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>setUnitAttr = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>attr,</td></tr><tr><td></td><td class=PParameter nowrap>val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Sets an element&rsquo;s attribute based on the unit in its current value.</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>canvas.isValidUnit = function(</td><td class=PParameter nowrap>attr,</td></tr><tr><td></td><td class=PParameter nowrap>val</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Check if an attribute&rsquo;s value is in a valid format</div></div><div class=CToolTip id="tt6"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var ChangeElementCommand = this.undoCmd.changeElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>attrs,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>History command to make a change to an element. </div></div><div class=CToolTip id="tt7"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var InsertElementCommand = this.undoCmd.insertElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>History command for an element that was added to the DOM</div></div><div class=CToolTip id="tt8"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var RemoveElementCommand = this.undoCmd.removeElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>parent,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>History command for an element removed from the DOM</div></div><div class=CToolTip id="tt9"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var MoveElementCommand = this.undoCmd.moveElement = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>oldNextSibling,</td></tr><tr><td></td><td class=PParameter nowrap>oldParent,</td></tr><tr><td></td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>History command for an element that had its DOM position changed</div></div><div class=CToolTip id="tt10"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var BatchCommand = this.undoCmd.batch = function(</td><td class=PParameter nowrap>text</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>History command that can contain/execute multiple other commands</div></div><div class=CToolTip id="tt11"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>resetUndoStack = function()</td></tr></table></blockquote>Resets the undo stack, effectively clearing the undo/redo history</div></div><div class=CToolTip id="tt12"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>addCommandToHistory = c.undoCmd.add = function(</td><td class=PParameter nowrap>cmd</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Adds a command object to the undo history stack</div></div><div class=CToolTip id="tt13"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>c.beginUndoableChange = function(</td><td class=PParameter nowrap>attrName,</td></tr><tr><td></td><td class=PParameter nowrap>elems</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>This function tells the canvas to remember the old values of the attrName attribute for each element sent in. </div></div><div class=CToolTip id="tt14"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>c.finishUndoableChange = function()</td></tr></table></blockquote>This function returns a BatchCommand object which summarizes the change since beginUndoableChange was called. </div></div><div class=CToolTip id="tt15"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var assignAttributes = this.assignAttributes = function(</td><td class=PParameter nowrap>node,</td></tr><tr><td></td><td class=PParameter nowrap>attrs,</td></tr><tr><td></td><td class=PParameter nowrap>suspendLength,</td></tr><tr><td></td><td class=PParameter nowrap>unitCheck</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Assigns multiple attributes to an element.</div></div><div class=CToolTip id="tt16"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var cleanupElement = this.cleanupElement = function(</td><td class=PParameter nowrap>element</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Remove unneeded (default) attributes, makes resulting SVG smaller</div></div><div class=CToolTip id="tt17"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var addSvgElementFromJson = this.addSvgElementFromJson = function(</td><td class=PParameter nowrap>data</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Create a new SVG element based on the given object keys/values and add it to the current layer The element will be ran through cleanupElement before being returned</div></div><div class=CToolTip id="tt18"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>getId = c.getId = function()</td></tr></table></blockquote>Returns the last created DOM element ID string</div></div><div class=CToolTip id="tt19"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>getNextId = c.getNextId = function()</td></tr></table></blockquote>Creates and returns a unique ID string for a DOM element</div></div><div class=CToolTip id="tt20"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>c.bind = function(</td><td class=PParameter nowrap>event,</td></tr><tr><td></td><td class=PParameter nowrap>f</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Attaches a callback function to an event</div></div><div class=CToolTip id="tt21"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>c.setIdPrefix = function(</td><td class=PParameter nowrap>p</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Changes the ID prefix to the given value</div></div><div class=CToolTip id="tt22"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var sanitizeSvg = this.sanitizeSvg = function(</td><td class=PParameter nowrap>node</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Sanitizes the input node and its children It only keeps what is allowed from our whitelist defined above</div></div><div class=CToolTip id="tt23"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var getUrlFromAttr = this.getUrlFromAttr = function(</td><td class=PParameter nowrap>attrVal</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>i.e. </div></div><div class=CToolTip id="tt24"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.clearSelection = function(</td><td class=PParameter nowrap>noCall</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Clears the selection. </div></div><div class=CToolTip id="tt25"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.addToSelection = function(</td><td class=PParameter nowrap>elemsToAdd,</td></tr><tr><td></td><td class=PParameter nowrap>showGrips</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Adds a list of elements to the selection. </div></div><div class=CToolTip id="tt26"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.removeFromSelection = function(</td><td class=PParameter nowrap>elemsToRemove</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Removes elements from the selection.</div></div><div class=CToolTip id="tt27"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>var removeUnusedDefElems = this.removeUnusedDefElems = function()</td></tr></table></blockquote>Looks at DOM elements inside the defs to see if they are referred to, removes them from the DOM if they are not.</div></div><div class=CToolTip id="tt28"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>var svgCanvasToString = this.svgCanvasToString = function()</td></tr></table></blockquote>Main function to set up the SVG content for output</div></div><div class=CToolTip id="tt29"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>var svgToString = this.svgToString = function(</td><td class=PParameter nowrap>elem,</td></tr><tr><td></td><td class=PParameter nowrap>indent</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Sub function ran on each SVG element to convert it to a string as desired</div></div><div class=CToolTip id="tt30"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.embedImage = function(</td><td class=PParameter nowrap>val,</td></tr><tr><td></td><td class=PParameter nowrap>callback</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Converts a given image file to a data URL when possible, then runs a given callback</div></div><div class=CToolTip id="tt31"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.save = function(</td><td class=PParameter nowrap>opts</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Serializes the current drawing into SVG XML text and returns it to the &lsquo;saved&rsquo; handler. </div></div><div class=CToolTip id="tt32"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getSvgString = function()</td></tr></table></blockquote>Returns the current drawing as raw SVG XML text.</div></div><div class=CToolTip id="tt33"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setSvgString = function(</td><td class=PParameter nowrap>xmlString</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>This function sets the current drawing as the input SVG XML.</div></div><div class=CToolTip id="tt34"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.createLayer = function(</td><td class=PParameter nowrap>name</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Creates a new top-level layer in the drawing with the given name, sets the current layer to it, and then clears the selection This function then calls the &lsquo;changed&rsquo; handler. </div></div><div class=CToolTip id="tt35"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.deleteCurrentLayer = function()</td></tr></table></blockquote>Deletes the current layer from the drawing and then clears the selection. </div></div><div class=CToolTip id="tt36"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getNumLayers = function()</td></tr></table></blockquote>Returns the number of layers in the current drawing.</div></div><div class=CToolTip id="tt37"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.getLayer = function(</td><td class=PParameter nowrap>i</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the name of the ith layer. </div></div><div class=CToolTip id="tt38"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getCurrentLayer = function()</td></tr></table></blockquote>Returns the name of the currently selected layer. </div></div><div class=CToolTip id="tt39"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setCurrentLayer = function(</td><td class=PParameter nowrap>name</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Sets the current layer. </div></div><div class=CToolTip id="tt40"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.renameCurrentLayer = function(</td><td class=PParameter nowrap>newname</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Renames the current layer. </div></div><div class=CToolTip id="tt41"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setCurrentLayerPosition = function(</td><td class=PParameter nowrap>newpos</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Changes the position of the current layer to the new value. </div></div><div class=CToolTip id="tt42"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.getLayerVisibility = function(</td><td class=PParameter nowrap>layername</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Returns whether the layer is visible. </div></div><div class=CToolTip id="tt43"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setLayerVisibility = function(</td><td class=PParameter nowrap>layername,</td></tr><tr><td></td><td class=PParameter nowrap>bVisible</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Sets the visibility of the layer. </div></div><div class=CToolTip id="tt44"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.moveSelectedToLayer = function(</td><td class=PParameter nowrap>layername</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Moves the selected elements to layername. </div></div><div class=CToolTip id="tt45"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.getLayerOpacity = function(</td><td class=PParameter nowrap>layername</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Returns the opacity of the given layer. </div></div><div class=CToolTip id="tt46"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>this.setLayerOpacity = function(</td><td class=PParameter nowrap>layername,</td></tr><tr><td></td><td class=PParameter nowrap>opacity</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Sets the opacity of the given layer. </div></div><div class=CToolTip id="tt47"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.selectAllInCurrentLayer = function()</td></tr></table></blockquote>Clears the selection, then adds all elements in the current layer to the selection. </div></div><div class=CToolTip id="tt48"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.clear = function()</td></tr></table></blockquote>Clears the current document. </div></div><div class=CToolTip id="tt49"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>this.getVersion = function()</td></tr></table></blockquote>Returns a string which describes the revision number of SvgCanvas.</div></div><!--END_ND_TOOLTIPS-->
<div id=MSearchResultsWindow><iframe src="" frameborder=0 name=MSearchResults id=MSearchResults></iframe><a href="javascript:searchPanel.CloseResultsWindow()" id=MSearchResultsWindowClose>Close</a></div>
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>