UNPKG

svgedit

Version:

Powerful SVG-Editor for your browser

4,365 lines (1,129 loc) 117 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Module: utilities</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Module: utilities</h1> <section> <header> </header> <article> <div class="container-overview"> <div class="description"><p>Miscellaneous utilities.</p></div> <dl class="details"> <dt class="tag-copyright">Copyright:</dt> <dd class="tag-copyright"><ul class="dummy"><li>2010 Alexis Deveria, 2010 Jeff Schiller</li></ul></dd> <dt class="tag-license">License:</dt> <dd class="tag-license"><ul class="dummy"><li>MIT</li></ul></dd> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line1">line 1</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Interfaces</h3> <dl> <dt><a href="module-utilities.EditorContext.html">EditorContext</a></dt> <dd></dd> </dl> <h3 class="subsection-title">Members</h3> <h4 class="name" id=".blankPageObjectURL"><span class="type-signature">(static, constant) </span>blankPageObjectURL<span class="type-signature"></span></h4> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>blankPageObjectURL</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line212">line 212</a> </li></ul></dd> </dl> <h4 class="name" id=".isNullish"><span class="type-signature">(static, constant) </span>isNullish<span class="type-signature"></span></h4> <div class="description"> <p>Whether a value is <code>null</code> or <code>undefined</code>.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line1234">line 1234</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".assignAttributes"><span class="type-signature">(static) </span>assignAttributes<span class="signature">(elem, attrs, suspendLength<span class="signature-attributes">opt</span>, unitCheck<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {void}</span></h4> <div class="description"> <p>Assigns multiple attributes to an element.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>DOM element to apply new attribute values to</p></td> </tr> <tr> <td class="name"><code>attrs</code></td> <td class="type"> <span class="param-type"><a href="global.html#PlainObject">PlainObject</a>.&lt;string, string></span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>Object with attribute keys/values</p></td> </tr> <tr> <td class="name"><code>suspendLength</code></td> <td class="type"> <span class="param-type"><a href="global.html#Integer">Integer</a></span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Milliseconds to suspend redraw</p></td> </tr> <tr> <td class="name"><code>unitCheck</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> false </td> <td class="description last"><p>Boolean to indicate the need to use units.setUnitAttr</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line1130">line 1130</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">void</span> </dd> </dl> <h4 class="name" id=".bboxToObj"><span class="type-signature">(static) </span>bboxToObj<span class="signature">(bbox)</span><span class="type-signature"> &rarr; {<a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a>}</span></h4> <div class="description"> <p>Converts a <code>SVGRect</code> into an object.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>bbox</code></td> <td class="type"> <span class="param-type">SVGRect</span> </td> <td class="description last"><p>a SVGRect</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line269">line 269</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>An object with properties names x, y, width, height.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a></span> </dd> </dl> <h4 class="name" id=".cleanupElement"><span class="type-signature">(static) </span>cleanupElement<span class="signature">(element)</span><span class="type-signature"> &rarr; {void}</span></h4> <div class="description"> <p>Remove unneeded (default) attributes, making resulting SVG smaller.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>element</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>DOM element to clean up</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line1162">line 1162</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">void</span> </dd> </dl> <h4 class="name" id=".convertToPath"><span class="type-signature">(static) </span>convertToPath<span class="signature">(elem, attrs, addSVGElementFromJson, pathActions, clearSelection, addToSelection, hstry, addCommandToHistory)</span><span class="type-signature"> &rarr; {SVGPathElement|null}</span></h4> <div class="description"> <p>Convert selected element to a path.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>The DOM element to be converted</p></td> </tr> <tr> <td class="name"><code>attrs</code></td> <td class="type"> <span class="param-type"><a href="module-utilities.html#.SVGElementJSON">module:utilities.SVGElementJSON</a></span> </td> <td class="description last"><p>Apply attributes to new path. see canvas.convertToPath</p></td> </tr> <tr> <td class="name"><code>addSVGElementFromJson</code></td> <td class="type"> <span class="param-type"><a href="module-utilities.EditorContext.html#addSVGElementFromJson">module:utilities.EditorContext#addSVGElementFromJson</a></span> </td> <td class="description last"><p>Function to add the path element to the current layer. See canvas.addSVGElementFromJson</p></td> </tr> <tr> <td class="name"><code>pathActions</code></td> <td class="type"> <span class="param-type"><a href="module-path.html#.pathActions">module:path.pathActions</a></span> </td> <td class="description last"><p>If a transform exists, pathActions.resetOrientation() is used. See: canvas.pathActions.</p></td> </tr> <tr> <td class="name"><code>clearSelection</code></td> <td class="type"> <span class="param-type"><a href="module-draw.DrawCanvasInit.html#clearSelection">module:draw.DrawCanvasInit#clearSelection</a></span> | <span class="param-type"><a href="module-path.EditorContext.html#clearSelection">module:path.EditorContext#clearSelection</a></span> </td> <td class="description last"><p>see <a href="module-svgcanvas.SvgCanvas.html#clearSelection"><code>canvas.clearSelection</code></a></p></td> </tr> <tr> <td class="name"><code>addToSelection</code></td> <td class="type"> <span class="param-type"><a href="module-path.EditorContext.html#addToSelection">module:path.EditorContext#addToSelection</a></span> </td> <td class="description last"><p>see <a href="module-svgcanvas.SvgCanvas.html#addToSelection"><code>canvas.addToSelection</code></a></p></td> </tr> <tr> <td class="name"><code>hstry</code></td> <td class="type"> <span class="param-type"><a href="module-history.html">module:history</a></span> </td> <td class="description last"><p>see history module</p></td> </tr> <tr> <td class="name"><code>addCommandToHistory</code></td> <td class="type"> <span class="param-type"><a href="module-path.EditorContext.html#addCommandToHistory">module:path.EditorContext#addCommandToHistory</a></span> | <span class="param-type"><a href="module-draw.DrawCanvasInit.html#addCommandToHistory">module:draw.DrawCanvasInit#addCommandToHistory</a></span> </td> <td class="description last"><p>see <a href="module-svgcanvas.html#~addCommandToHistory"><code>canvas.addCommandToHistory</code></a></p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line775">line 775</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The converted path element or null if the DOM element was not recognized.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">SVGPathElement</span> | <span class="param-type">null</span> </dd> </dl> <h4 class="name" id=".convertToXMLReferences"><span class="type-signature">(static) </span>convertToXMLReferences<span class="signature">(input)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Converts a string to use XML references (for non-ASCII).</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line220">line 220</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Decimal numeric character references</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".copyElem"><span class="type-signature">(static) </span>copyElem<span class="signature">(el, getNextId)</span><span class="type-signature"> &rarr; {Element}</span></h4> <div class="description"> <p>Create a clone of an element, updating its ID and its children's IDs when needed.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>el</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>DOM element to clone</p></td> </tr> <tr> <td class="name"><code>getNextId</code></td> <td class="type"> <span class="param-type"><a href="module-utilities.html#.GetNextID">module:utilities.GetNextID</a></span> </td> <td class="description last"><p>The getter of the next unique ID.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_copy-elem.js.html">svgcanvas/copy-elem.js</a>, <a href="svgcanvas_copy-elem.js.html#line3">line 3</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The cloned element</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Element</span> </dd> </dl> <h4 class="name" id=".createObjectURL"><span class="type-signature">(static) </span>createObjectURL<span class="signature">(blob)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Get object URL for a blob object.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>blob</code></td> <td class="type"> <span class="param-type">Blob</span> </td> <td class="description last"><p>A Blob object or File object</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line196">line 196</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>object URL or empty string</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".dataURLToObjectURL"><span class="type-signature">(static) </span>dataURLToObjectURL<span class="signature">(dataurl)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Convert dataURL to object URL.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>dataurl</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line169">line 169</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>object URL or empty string</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".decode64"><span class="type-signature">(static) </span>decode64<span class="signature">(input)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Converts a string from base64.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>Base64-encoded input</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line140">line 140</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Decoded output</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".decodeUTF8"><span class="type-signature">(static) </span>decodeUTF8<span class="signature">(argString)</span><span class="type-signature"> &rarr; {string}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>argString</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line150">line 150</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".dropXMLInternalSubset"><span class="type-signature">(static) </span>dropXMLInternalSubset<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Used to prevent the <a href="https://en.wikipedia.org/wiki/Billion_laughs_attack">Billion laughs attack</a>.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>str</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>String to be processed</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line91">line 91</a> </li></ul></dd> <dt class="tag-todo">To Do:</dt> <dd class="tag-todo"> <ul> <li>This might be needed in other places `parseFromString` is used even without LGTM flagging</li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The string with entity declarations in the internal subset removed</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".encode64"><span class="type-signature">(static) </span>encode64<span class="signature">(input)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Converts a string to base64.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line128">line 128</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Base64 output</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".encodeUTF8"><span class="type-signature">(static) </span>encodeUTF8<span class="signature">(argString)</span><span class="type-signature"> &rarr; {string}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>argString</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line160">line 160</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".findDefs"><span class="type-signature">(static) </span>findDefs<span class="signature">()</span><span class="type-signature"> &rarr; {SVGDefsElement}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line367">line 367</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The document's <code>&lt;defs&gt;</code> element, creating it first if necessary</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">SVGDefsElement</span> </dd> </dl> <h4 class="name" id=".getBBox"><span class="type-signature">(static) </span>getBBox<span class="signature">(elem)</span><span class="type-signature"> &rarr; {<a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a>}</span></h4> <div class="description"> <p>Get the given/selected element's bounding box object, convert it to be more usable when necessary.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>Optional DOM element to get the BBox for</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line525">line 525</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Bounding box object</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a></span> </dd> </dl> <h4 class="name" id=".getBBoxOfElementAsPath"><span class="type-signature">(static) </span>getBBoxOfElementAsPath<span class="signature">(elem, addSVGElementFromJson, pathActions)</span><span class="type-signature"> &rarr; {DOMRect|false}</span></h4> <div class="description"> <p>Get the BBox of an element-as-path.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>The DOM element to be probed</p></td> </tr> <tr> <td class="name"><code>addSVGElementFromJson</code></td> <td class="type"> <span class="param-type"><a href="module-utilities.EditorContext.html#addSVGElementFromJson">module:utilities.EditorContext#addSVGElementFromJson</a></span> </td> <td class="description last"><p>Function to add the path element to the current layer. See canvas.addSVGElementFromJson</p></td> </tr> <tr> <td class="name"><code>pathActions</code></td> <td class="type"> <span class="param-type"><a href="module-path.html#.pathActions">module:path.pathActions</a></span> </td> <td class="description last"><p>If a transform exists, <code>pathActions.resetOrientation()</code> is used. See: canvas.pathActions.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line730">line 730</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The resulting path's bounding box object.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">DOMRect</span> | <span class="param-type">false</span> </dd> </dl> <h4 class="name" id=".getBBoxWithTransform"><span class="type-signature">(static) </span>getBBoxWithTransform<span class="signature">(elem, addSVGElementFromJson, pathActions)</span><span class="type-signature"> &rarr; {<a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a>|<a href="module-math.html#.TransformedBox">module:math.TransformedBox</a>|DOMRect}</span></h4> <div class="description"> <p>Get bounding box that includes any transforms.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>The DOM element to be converted</p></td> </tr> <tr> <td class="name"><code>addSVGElementFromJson</code></td> <td class="type"> <span class="param-type"><a href="module-utilities.EditorContext.html#addSVGElementFromJson">module:utilities.EditorContext#addSVGElementFromJson</a></span> </td> <td class="description last"><p>Function to add the path element to the current layer. See canvas.addSVGElementFromJson</p></td> </tr> <tr> <td class="name"><code>pathActions</code></td> <td class="type"> <span class="param-type"><a href="module-path.html#.pathActions">module:path.pathActions</a></span> </td> <td class="description last"><p>If a transform exists, pathActions.resetOrientation() is used. See: canvas.pathActions.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line875">line 875</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A single bounding box object</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a></span> | <span class="param-type"><a href="module-math.html#.TransformedBox">module:math.TransformedBox</a></span> | <span class="param-type">DOMRect</span> </dd> </dl> <h4 class="name" id=".getElem"><span class="type-signature">(static) </span>getElem<span class="signature">(id)</span><span class="type-signature"> &rarr; (nullable) {Element}</span></h4> <div class="description"> <p>Get a DOM element by ID within the SVG root element.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>id</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>String with the element's new ID</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line1119">line 1119</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Element</span> </dd> </dl> <h4 class="name" id=".getExtraAttributesForConvertToPath"><span class="type-signature">(static) </span>getExtraAttributesForConvertToPath<span class="signature">(elem)</span><span class="type-signature"> &rarr; {<a href="global.html#PlainObject">PlainObject</a>.&lt;("marker-start"|"marker-end"|"marker-mid"|"filter"|"clip-path"), string>}</span></h4> <div class="description"> <p>Get a set of attributes from an element that is useful for convertToPath.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>The element to be probed</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line711">line 711</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>An object with attributes.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#PlainObject">PlainObject</a>.&lt;("marker-start"|"marker-end"|"marker-mid"|"filter"|"clip-path"), string></span> </dd> </dl> <h4 class="name" id=".getFeGaussianBlur"><span class="type-signature">(static) </span>getFeGaussianBlur<span class="signature">(Element)</span><span class="type-signature"> &rarr; {any}</span></h4> <div class="description"> <p>Get the reference element associated with the given attribute value.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Element</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line1098">line 1098</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>Reference element</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">any</span> </dd> </dl> <h4 class="name" id=".getHref"><span class="type-signature">(static) </span>getHref<span class="signature">(elem)</span><span class="type-signature"> &rarr; {string}</span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line347">line 347</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The given element's <code>xlink:href</code> value</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".getPathBBox"><span class="type-signature">(static) </span>getPathBBox<span class="signature">(path)</span><span class="type-signature"> &rarr; {<a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a>}</span></h4> <div class="description"> <p>Get correct BBox for a path in Webkit. Converted from code found <a href="http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html">here</a>.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>path</code></td> <td class="type"> <span class="param-type">SVGPathElement</span> </td> <td class="description last"><p>The path DOM element to get the BBox for</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line391">line 391</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>A BBox-like object</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="module-utilities.html#.BBoxObject">module:utilities.BBoxObject</a></span> </dd> </dl> <h4 class="name" id=".getPathDFromElement"><span class="type-signature">(static) </span>getPathDFromElement<span class="signature">(elem)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Make a path 'd' attribute from a simple SVG element shape.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>elem</code></td> <td class="type"> <span class="param-type">Element</span> </td> <td class="description last"><p>The element to be converted</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="svgcanvas_utilities.js.html">svgcanvas/utilities.js</a>, <a href="svgcanvas_utilities.js.html#line625">line 625</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> <p>The path d attribute or <code>undefined</code> if the element type is unknown.</p> </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".getPathDFromSegments"><span class="type-signature">(static) </span>getPathDFromSegments<span class="signature">(pathSegments)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> <p>Create a path 'd' attribute from path segments. Each segment is an array of the form: <code>[singleChar, [x,y, x,y, ...]]</code></p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th