unit2px and getBBox fix

Fix for Firefox bug when getBBox throws an exception.
master
Dmitry Baranovskiy 2014-05-21 12:38:18 +10:00
parent c1e8a98db9
commit b92dcb5af5
5 changed files with 127 additions and 130 deletions

File diff suppressed because one or more lines are too long

53
dist/snap.svg.js vendored
View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// build: 2014-05-20
// build: 2014-05-21
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -1770,13 +1770,13 @@ function getSomeDefs(el) {
}
Snap._.getSomeDefs = getSomeDefs;
function unit2px(el, name, value) {
var defs = getSomeDefs(el),
var svg = el.node.ownerSVGElement,
out = {},
mgr = defs.querySelector(".svg---mgr");
mgr = svg.querySelector(".svg---mgr");
if (!mgr) {
mgr = $("rect");
$(mgr, {width: 10, height: 10, "class": "svg---mgr"});
defs.appendChild(mgr);
$(mgr, {x: -9e9, y: -9e9, width: 10, height: 10, "class": "svg---mgr", fill: "none"});
svg.appendChild(mgr);
}
function getW(val) {
if (val == null) {
@ -1850,6 +1850,7 @@ function unit2px(el, name, value) {
default:
set(name, getW);
}
mgr.remove();
return out;
}
/*\
@ -2046,7 +2047,7 @@ function arrayFirstValue(arr) {
var el = this,
m = new Snap.Matrix;
if (el.removed) {
return {};
return Snap._.box();
}
while (el.type == "use") {
if (!isWithoutTransform) {
@ -2059,16 +2060,22 @@ function arrayFirstValue(arr) {
el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
}
}
var _ = el._;
if (isWithoutTransform) {
_.bboxwt = Snap.path.get[el.type] ? Snap.path.getBBox(el.realPath = Snap.path.get[el.type](el)) : Snap._.box(el.node.getBBox());
return Snap._.box(_.bboxwt);
} else {
el.realPath = (Snap.path.get[el.type] || Snap.path.get.deflt)(el);
el.matrix = el.transform().localMatrix;
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
var _ = el._,
pathfinder = Snap.path.get[el.type] || Snap.path.get.deflt;
try {
if (isWithoutTransform) {
_.bboxwt = pathfinder ? Snap.path.getBBox(el.realPath = pathfinder(el)) : Snap._.box(el.node.getBBox());
return Snap._.box(_.bboxwt);
} else {
el.realPath = pathfinder(el);
el.matrix = el.transform().localMatrix;
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
return Snap._.box(_.bbox);
}
} catch (e) {
// Firefox doesnt give you bbox of hidden element
return Snap._.box();
}
return Snap._.box(_.bbox);
};
var propString = function () {
return this.string;
@ -5402,18 +5409,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
var attr = unit2px(el);
return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height);
},
text: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
g: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
symbol: function (el) {
var bbox = el.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
line: function (el) {
return "M" + [el.attr("x1") || 0, el.attr("y1") || 0, el.attr("x2"), el.attr("y2")];
},
@ -5423,10 +5418,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
polygon: function (el) {
return "M" + el.attr("points") + "z";
},
svg: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
deflt: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);

View File

@ -2610,7 +2610,7 @@ Parses given transform string into an array of transformations
<article id="Snap.select">
<header>
<h3 class="dr-method">Snap.select(query)<a href="#Snap.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1105 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1105">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.select(query)<a href="#Snap.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1106 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1106">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.select-extra"></div>
@ -2670,7 +2670,7 @@ Parses given transform string into an array of transformations
<article id="Snap.selectAll">
<header>
<h3 class="dr-method">Snap.selectAll(query)<a href="#Snap.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1116 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1116">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.selectAll(query)<a href="#Snap.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1117 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1117">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.selectAll-extra"></div>
@ -2730,7 +2730,7 @@ Parses given transform string into an array of transformations
<article id="Element.node">
<header>
<h3 class="dr-property">Element.node(x, y, width, height, refX, refY)<a href="#Element.node" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1179 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1179">&#x27ad;</a></h3>
<h3 class="dr-property">Element.node(x, y, width, height, refX, refY)<a href="#Element.node" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1180 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1180">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.node-extra"></div>
@ -2781,7 +2781,7 @@ c.node.onclick = function () {
<article id="Element.type">
<header>
<h3 class="dr-property">Element.type(tstr)<a href="#Element.type" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1189 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1189">&#x27ad;</a></h3>
<h3 class="dr-property">Element.type(tstr)<a href="#Element.type" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1190 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1190">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.type-extra"></div>
@ -2806,7 +2806,7 @@ c.node.onclick = function () {
<article id="Element.attr">
<header>
<h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1240 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1240">&#x27ad;</a></h3>
<h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1241 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1241">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.attr-extra"></div>
@ -2965,7 +2965,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.getBBox">
<header>
<h3 class="dr-method">Element.getBBox()<a href="#Element.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1287 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1287">&#x27ad;</a></h3>
<h3 class="dr-method">Element.getBBox()<a href="#Element.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1288 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1288">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.getBBox-extra"></div>
@ -3147,7 +3147,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.transform">
<header>
<h3 class="dr-method">Element.transform(tstr)<a href="#Element.transform" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1338 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1338">&#x27ad;</a></h3>
<h3 class="dr-method">Element.transform(tstr)<a href="#Element.transform" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1345 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1345">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.transform-extra"></div>
@ -3311,7 +3311,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.parent">
<header>
<h3 class="dr-method">Element.parent()<a href="#Element.parent" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1395 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1395">&#x27ad;</a></h3>
<h3 class="dr-method">Element.parent()<a href="#Element.parent" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1402 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1402">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.parent-extra"></div>
@ -3353,7 +3353,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.append">
<header>
<h3 class="dr-method">Element.append(el)<a href="#Element.append" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1407 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1407">&#x27ad;</a></h3>
<h3 class="dr-method">Element.append(el)<a href="#Element.append" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1414 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1414">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.append-extra"></div>
@ -3413,7 +3413,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.add">
<header>
<h3 class="dr-method">Element.add()<a href="#Element.add" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1413 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1413">&#x27ad;</a></h3>
<h3 class="dr-method">Element.add()<a href="#Element.add" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1420 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1420">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.add-extra"></div>
@ -3438,7 +3438,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.appendTo">
<header>
<h3 class="dr-method">Element.appendTo(el)<a href="#Element.appendTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1437 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1437">&#x27ad;</a></h3>
<h3 class="dr-method">Element.appendTo(el)<a href="#Element.appendTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1444 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1444">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.appendTo-extra"></div>
@ -3498,7 +3498,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.prepend">
<header>
<h3 class="dr-method">Element.prepend(el)<a href="#Element.prepend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1453 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1453">&#x27ad;</a></h3>
<h3 class="dr-method">Element.prepend(el)<a href="#Element.prepend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1460 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1460">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.prepend-extra"></div>
@ -3558,7 +3558,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.prependTo">
<header>
<h3 class="dr-method">Element.prependTo(el)<a href="#Element.prependTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1487 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1487">&#x27ad;</a></h3>
<h3 class="dr-method">Element.prependTo(el)<a href="#Element.prependTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1494 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1494">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.prependTo-extra"></div>
@ -3618,7 +3618,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.before">
<header>
<h3 class="dr-method">Element.before(el)<a href="#Element.before" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1501 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1501">&#x27ad;</a></h3>
<h3 class="dr-method">Element.before(el)<a href="#Element.before" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1508 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1508">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.before-extra"></div>
@ -3678,7 +3678,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.after">
<header>
<h3 class="dr-method">Element.after(el)<a href="#Element.after" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1529 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1529">&#x27ad;</a></h3>
<h3 class="dr-method">Element.after(el)<a href="#Element.after" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1536 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1536">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.after-extra"></div>
@ -3738,7 +3738,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.insertBefore">
<header>
<h3 class="dr-method">Element.insertBefore(el)<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1551 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1551">&#x27ad;</a></h3>
<h3 class="dr-method">Element.insertBefore(el)<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1558 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1558">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.insertBefore-extra"></div>
@ -3798,7 +3798,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.insertAfter">
<header>
<h3 class="dr-method">Element.insertAfter(el)<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1569 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1569">&#x27ad;</a></h3>
<h3 class="dr-method">Element.insertAfter(el)<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1576 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1576">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.insertAfter-extra"></div>
@ -3858,7 +3858,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.remove">
<header>
<h3 class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1585 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1585">&#x27ad;</a></h3>
<h3 class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1592 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1592">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.remove-extra"></div>
@ -3900,7 +3900,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.select">
<header>
<h3 class="dr-method">Element.select(query)<a href="#Element.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1602 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1602">&#x27ad;</a></h3>
<h3 class="dr-method">Element.select(query)<a href="#Element.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1609 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1609">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.select-extra"></div>
@ -3960,7 +3960,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.selectAll">
<header>
<h3 class="dr-method">Element.selectAll(query)<a href="#Element.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1614 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1614">&#x27ad;</a></h3>
<h3 class="dr-method">Element.selectAll(query)<a href="#Element.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1621 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1621">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.selectAll-extra"></div>
@ -4022,7 +4022,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.asPX">
<header>
<h3 class="dr-method">Element.asPX(attr, [value])<a href="#Element.asPX" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1632 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1632">&#x27ad;</a></h3>
<h3 class="dr-method">Element.asPX(attr, [value])<a href="#Element.asPX" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1639 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1639">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.asPX-extra"></div>
@ -4085,7 +4085,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.use">
<header>
<h3 class="dr-method">Element.use()<a href="#Element.use" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1647 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1647">&#x27ad;</a></h3>
<h3 class="dr-method">Element.use()<a href="#Element.use" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1654 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1654">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.use-extra"></div>
@ -4127,7 +4127,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.clone">
<header>
<h3 class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1676 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1676">&#x27ad;</a></h3>
<h3 class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1683 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1683">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.clone-extra"></div>
@ -4169,7 +4169,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.toDefs">
<header>
<h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1847 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1847">&#x27ad;</a></h3>
<h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1854 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1854">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.toDefs-extra"></div>
@ -4211,7 +4211,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.pattern">
<header>
<h3 class="dr-method">Element.pattern()<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1858 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1858">&#x27ad;</a></h3>
<h3 class="dr-method">Element.pattern()<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1865 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1865">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.pattern-extra"></div>
@ -4236,7 +4236,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Element.toPattern">
<header>
<h3 class="dr-method">Element.toPattern(x, y, width, height)<a href="#Element.toPattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1881 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1881">&#x27ad;</a></h3>
<h3 class="dr-method">Element.toPattern(x, y, width, height)<a href="#Element.toPattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1888 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1888">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.toPattern-extra"></div>
@ -4336,7 +4336,7 @@ c.attr({
<article id="Element.marker">
<header>
<h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1922 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1922">&#x27ad;</a></h3>
<h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1929 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1929">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.marker-extra"></div>
@ -4423,7 +4423,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animation">
<header>
<h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1981 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1981">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1988 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1988">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.animation-extra"></div>
@ -4492,7 +4492,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Element.inAnim">
<header>
<h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1999 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1999">&#x27ad;</a></h3>
<h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2006 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2006">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.inAnim-extra"></div>
@ -4594,7 +4594,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animate">
<header>
<h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2049 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2049">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2056 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2056">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.animate-extra"></div>
@ -4755,7 +4755,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.stop">
<header>
<h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2067 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2067">&#x27ad;</a></h3>
<h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2074 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2074">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.stop-extra"></div>
@ -4797,7 +4797,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.animate">
<header>
<h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2086 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2086">&#x27ad;</a></h3>
<h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2093 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2093">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.animate-extra"></div>
@ -4866,7 +4866,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.data">
<header>
<h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2159 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2159">&#x27ad;</a></h3>
<h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2166 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2166">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.data-extra"></div>
@ -4988,7 +4988,7 @@ with <code>data-</code> attributes)
<article id="Element.removeData">
<header>
<h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2188 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2188">&#x27ad;</a></h3>
<h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2195 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2195">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.removeData-extra"></div>
@ -5049,7 +5049,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.outerSVG">
<header>
<h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2205 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2205">&#x27ad;</a></h3>
<h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2212 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2212">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.outerSVG-extra"></div>
@ -5092,7 +5092,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.toString">
<header>
<h3 class="dr-method">Element.toString()<a href="#Element.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2211 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2211">&#x27ad;</a></h3>
<h3 class="dr-method">Element.toString()<a href="#Element.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2218 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2218">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.toString-extra"></div>
@ -5117,7 +5117,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.innerSVG">
<header>
<h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2219 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2219">&#x27ad;</a></h3>
<h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2226 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2226">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.innerSVG-extra"></div>
@ -5159,7 +5159,7 @@ If key is not provided, removes all the data of the element.
<article id="Snap.parse">
<header>
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2257 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2257">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2264 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2264">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.parse-extra"></div>
@ -5219,7 +5219,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.select">
<header>
<h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2289 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2289">&#x27ad;</a></h3>
<h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2296 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2296">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Fragment.select-extra"></div>
@ -5244,7 +5244,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.selectAll">
<header>
<h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2296 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2296">&#x27ad;</a></h3>
<h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2303 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2303">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Fragment.selectAll-extra"></div>
@ -5269,7 +5269,7 @@ If key is not provided, removes all the data of the element.
<article id="Snap.fragment">
<header>
<h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2307 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2307">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2314 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2314">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.fragment-extra"></div>
@ -5329,7 +5329,7 @@ If key is not provided, removes all the data of the element.
<article id="Paper.el">
<header>
<h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2410 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2410">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2417 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2417">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.el-extra"></div>
@ -5425,7 +5425,7 @@ var c = paper.el("circle", {
<article id="Snap.ajax">
<header>
<h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2528 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2528">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2535 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2535">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.ajax-extra"></div>
@ -5529,7 +5529,7 @@ var c = paper.el("circle", {
<article id="Snap.load">
<header>
<h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2574 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2574">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2581 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2581">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.load-extra"></div>
@ -5578,7 +5578,7 @@ var c = paper.el("circle", {
<article id="Snap.getElementByPoint">
<header>
<h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2605 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2605">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2612 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2612">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.getElementByPoint-extra"></div>
@ -5663,7 +5663,7 @@ var c = paper.el("circle", {
<article id="Snap.plugin">
<header>
<h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2640 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2640">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2647 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L2647">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.plugin-extra"></div>
@ -11452,7 +11452,7 @@ half the width, from black to white:
<article id="Snap.path.getTotalLength">
<header>
<h3 class="dr-method">Snap.path.getTotalLength(path)<a href="#Snap.path.getTotalLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1143 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1143">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.getTotalLength(path)<a href="#Snap.path.getTotalLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1127 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1127">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.getTotalLength-extra"></div>
@ -11512,7 +11512,7 @@ half the width, from black to white:
<article id="Snap.path.getPointAtLength">
<header>
<h3 class="dr-method">Snap.path.getPointAtLength(path, length)<a href="#Snap.path.getPointAtLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1160 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1160">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.getPointAtLength(path, length)<a href="#Snap.path.getPointAtLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1144 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1144">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.getPointAtLength-extra"></div>
@ -11619,7 +11619,7 @@ half the width, from black to white:
<article id="Snap.path.getSubpath">
<header>
<h3 class="dr-method">Snap.path.getSubpath(path, from, to)<a href="#Snap.path.getSubpath" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1173 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1173">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.getSubpath(path, from, to)<a href="#Snap.path.getSubpath" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1157 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1157">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.getSubpath-extra"></div>
@ -11685,7 +11685,7 @@ half the width, from black to white:
<article id="Element.getTotalLength">
<header>
<h3 class="dr-method">Element.getTotalLength()<a href="#Element.getTotalLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1187 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1187">&#x27ad;</a></h3>
<h3 class="dr-method">Element.getTotalLength()<a href="#Element.getTotalLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1171 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1171">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.getTotalLength-extra"></div>
@ -11727,7 +11727,7 @@ half the width, from black to white:
<article id="Element.getPointAtLength">
<header>
<h3 class="dr-method">Element.getPointAtLength(length)<a href="#Element.getPointAtLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1208 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1208">&#x27ad;</a></h3>
<h3 class="dr-method">Element.getPointAtLength(length)<a href="#Element.getPointAtLength" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1192 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1192">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.getPointAtLength-extra"></div>
@ -11831,7 +11831,7 @@ half the width, from black to white:
<article id="Element.getSubpath">
<header>
<h3 class="dr-method">Element.getSubpath(from, to)<a href="#Element.getSubpath" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1223 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1223">&#x27ad;</a></h3>
<h3 class="dr-method">Element.getSubpath(from, to)<a href="#Element.getSubpath" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1207 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1207">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.getSubpath-extra"></div>
@ -11894,7 +11894,7 @@ half the width, from black to white:
<article id="Snap.path.findDotsAtSegment">
<header>
<h3 class="dr-method">Snap.path.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t)<a href="#Snap.path.findDotsAtSegment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1266 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1266">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t)<a href="#Snap.path.findDotsAtSegment" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1250 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1250">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.findDotsAtSegment-extra"></div>
@ -12119,7 +12119,7 @@ Finds dot coordinates on the given cubic beziér curve at the given t
<article id="Snap.path.bezierBBox">
<header>
<h3 class="dr-method">Snap.path.bezierBBox(…)<a href="#Snap.path.bezierBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1294 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1294">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.bezierBBox(…)<a href="#Snap.path.bezierBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1278 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1278">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.bezierBBox-extra"></div>
@ -12298,7 +12298,7 @@ Returns the bounding box of a given cubic beziér curve
<article id="Snap.path.isPointInsideBBox">
<header>
<h3 class="dr-method">Snap.path.isPointInsideBBox(bbox, x, y)<a href="#Snap.path.isPointInsideBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1307 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1307">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.isPointInsideBBox(bbox, x, y)<a href="#Snap.path.isPointInsideBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1291 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1291">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.isPointInsideBBox-extra"></div>
@ -12365,7 +12365,7 @@ Returns <code>true</code> if given point is inside bounding box
<article id="Snap.path.isBBoxIntersect">
<header>
<h3 class="dr-method">Snap.path.isBBoxIntersect(bbox1, bbox2)<a href="#Snap.path.isBBoxIntersect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1319 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1319">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.isBBoxIntersect(bbox1, bbox2)<a href="#Snap.path.isBBoxIntersect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1303 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1303">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.isBBoxIntersect-extra"></div>
@ -12429,7 +12429,7 @@ Returns <code>true</code> if two bounding boxes intersect
<article id="Snap.path.intersection">
<header>
<h3 class="dr-method">Snap.path.intersection(path1, path2)<a href="#Snap.path.intersection" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1343 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1343">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.intersection(path1, path2)<a href="#Snap.path.intersection" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1327 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1327">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.intersection-extra"></div>
@ -12585,7 +12585,7 @@ Finds intersections of two paths
<article id="Snap.path.isPointInside">
<header>
<h3 class="dr-method">Snap.path.isPointInside(path, x, y)<a href="#Snap.path.isPointInside" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1359 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1359">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.isPointInside(path, x, y)<a href="#Snap.path.isPointInside" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1343 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1343">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.isPointInside-extra"></div>
@ -12653,7 +12653,7 @@ Returns <code>true</code> if given point is inside a given closed path.
<article id="Snap.path.getBBox">
<header>
<h3 class="dr-method">Snap.path.getBBox(path)<a href="#Snap.path.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1378 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1378">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.getBBox(path)<a href="#Snap.path.getBBox" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1362 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1362">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.getBBox-extra"></div>
@ -12782,7 +12782,7 @@ Returns the bounding box of a given path
<article id="Snap.path.toRelative">
<header>
<h3 class="dr-method">Snap.path.toRelative(path)<a href="#Snap.path.toRelative" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1390 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1390">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.toRelative(path)<a href="#Snap.path.toRelative" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1374 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1374">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.toRelative-extra"></div>
@ -12843,7 +12843,7 @@ Converts path coordinates into relative values
<article id="Snap.path.toAbsolute">
<header>
<h3 class="dr-method">Snap.path.toAbsolute(path)<a href="#Snap.path.toAbsolute" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1401 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1401">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.toAbsolute(path)<a href="#Snap.path.toAbsolute" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1385 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1385">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.toAbsolute-extra"></div>
@ -12904,7 +12904,7 @@ Converts path coordinates into absolute values
<article id="Snap.path.toCubic">
<header>
<h3 class="dr-method">Snap.path.toCubic(pathString)<a href="#Snap.path.toCubic" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1412 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1412">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.toCubic(pathString)<a href="#Snap.path.toCubic" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1396 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1396">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.toCubic-extra"></div>
@ -12965,7 +12965,7 @@ Converts path to a new path where all segments are cubic beziér curves
<article id="Snap.path.map">
<header>
<h3 class="dr-method">Snap.path.map(path, matrix)<a href="#Snap.path.map" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1422 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1422">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.path.map(path, matrix)<a href="#Snap.path.map" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1406 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1406">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.path.map-extra"></div>

View File

@ -515,18 +515,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
var attr = unit2px(el);
return rectPath(attr.x || 0, attr.y || 0, attr.width, attr.height);
},
text: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
g: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
symbol: function (el) {
var bbox = el.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
line: function (el) {
return "M" + [el.attr("x1") || 0, el.attr("y1") || 0, el.attr("x2"), el.attr("y2")];
},
@ -536,10 +524,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
polygon: function (el) {
return "M" + el.attr("points") + "z";
},
svg: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);
},
deflt: function (el) {
var bbox = el.node.getBBox();
return rectPath(bbox.x, bbox.y, bbox.width, bbox.height);

View File

@ -1010,15 +1010,19 @@ function getSomeDefs(el) {
}
return defs;
}
function getSomeSVG(el) {
return el.node.ownerSVGElement && wrap(el.node.ownerSVGElement) || Snap.select("svg");
}
Snap._.getSomeDefs = getSomeDefs;
Snap._.getSomeSVG = getSomeSVG;
function unit2px(el, name, value) {
var defs = getSomeDefs(el),
var svg = getSomeSVG(el),
out = {},
mgr = defs.querySelector(".svg---mgr");
mgr = svg.querySelector(".svg---mgr");
if (!mgr) {
mgr = $("rect");
$(mgr, {width: 10, height: 10, "class": "svg---mgr"});
defs.appendChild(mgr);
$(mgr, {x: -9e9, y: -9e9, width: 10, height: 10, "class": "svg---mgr", fill: "none"});
svg.appendChild(mgr);
}
function getW(val) {
if (val == null) {
@ -1028,7 +1032,11 @@ function unit2px(el, name, value) {
return val;
}
$(mgr, {width: val});
return mgr.getBBox().width;
try {
return mgr.getBBox().width;
} catch (e) {
return 0;
}
}
function getH(val) {
if (val == null) {
@ -1038,7 +1046,11 @@ function unit2px(el, name, value) {
return val;
}
$(mgr, {height: val});
return mgr.getBBox().height;
try {
return mgr.getBBox().height;
} catch (e) {
return 0;
}
}
function set(nam, f) {
if (name == null) {
@ -1092,6 +1104,7 @@ function unit2px(el, name, value) {
default:
set(name, getW);
}
mgr.remove();
return out;
}
/*\
@ -1285,10 +1298,13 @@ function arrayFirstValue(arr) {
o }
\*/
elproto.getBBox = function (isWithoutTransform) {
if (!Snap.Matrix || !Snap.path) {
return this.getBBox();
}
var el = this,
m = new Snap.Matrix;
if (el.removed) {
return {};
return Snap._.box();
}
while (el.type == "use") {
if (!isWithoutTransform) {
@ -1301,16 +1317,22 @@ function arrayFirstValue(arr) {
el = el.original = el.node.ownerDocument.getElementById(href.substring(href.indexOf("#") + 1));
}
}
var _ = el._;
if (isWithoutTransform) {
_.bboxwt = Snap.path.get[el.type] ? Snap.path.getBBox(el.realPath = Snap.path.get[el.type](el)) : Snap._.box(el.node.getBBox());
return Snap._.box(_.bboxwt);
} else {
el.realPath = (Snap.path.get[el.type] || Snap.path.get.deflt)(el);
el.matrix = el.transform().localMatrix;
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
var _ = el._,
pathfinder = Snap.path.get[el.type] || Snap.path.get.deflt;
try {
if (isWithoutTransform) {
_.bboxwt = pathfinder ? Snap.path.getBBox(el.realPath = pathfinder(el)) : Snap._.box(el.node.getBBox());
return Snap._.box(_.bboxwt);
} else {
el.realPath = pathfinder(el);
el.matrix = el.transform().localMatrix;
_.bbox = Snap.path.getBBox(Snap.path.map(el.realPath, m.add(el.matrix)));
return Snap._.box(_.bbox);
}
} catch (e) {
// Firefox doesnt give you bbox of hidden element
return Snap._.box();
}
return Snap._.box(_.bbox);
};
var propString = function () {
return this.string;