master
Dmitry Baranovskiy 2013-11-19 18:03:38 +11:00
parent c2a42eef50
commit b324696ef0
4 changed files with 244 additions and 102 deletions

File diff suppressed because one or more lines are too long

60
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: 2013-11-18
// build: 2013-11-19
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -2013,7 +2013,8 @@ var contains = glob.doc.contains || glob.doc.compareDocumentPosition ?
} :
function (a, b) {
if (b) {
while (b = b.parentNode) {
while (b) {
b = b.parentNode;
if (b == a) {
return true;
}
@ -2187,13 +2188,7 @@ function Element(el) {
this.type = el.tagName;
this.anims = {};
this._ = {
transform: [],
sx: 1,
sy: 1,
deg: 0,
dx: 0,
dy: 0,
dirty: 1
transform: []
};
el.snap = id;
hub[id] = this;
@ -2537,7 +2532,7 @@ function arrayFirstValue(arr) {
if (value == null) {
value = this.attr(attr);
}
return unit2px(this, attr, value);
return +unit2px(this, attr, value);
};
// SIERRA Element.use(): I suggest adding a note about how to access the original element the returned <use> instantiates. It's a part of SVG with which ordinary web developers may be least familiar.
/*\
@ -4184,6 +4179,51 @@ eve.on("snap.util.getattr", function () {
return $(this.node, att);
}
});
var getOffset = function (elem) {
var box = elem.getBoundingClientRect(),
doc = elem.ownerDocument,
body = doc.body,
docElem = doc.documentElement,
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop ) - clientTop,
left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;
return {
y: top,
x: left
};
};
/*\
* Snap.getElementByPoint
[ method ]
**
* Returns you topmost element under given point.
**
= (object) Snap element object
- x (number) x coordinate from the top left corner of the window
- y (number) y coordinate from the top left corner of the window
> Usage
| Snap.getElementByPoint(mouseX, mouseY).attr({stroke: "#f00"});
\*/
Snap.getElementByPoint = function (x, y) {
var paper = this,
svg = paper.canvas,
target = glob.doc.elementFromPoint(x, y);
if (glob.win.opera && target.tagName == "svg") {
var so = getOffset(target),
sr = target.createSVGRect();
sr.x = x - so.x;
sr.y = y - so.y;
sr.width = sr.height = 1;
var hits = target.getIntersectionList(sr, null);
if (hits.length) {
target = hits[hits.length - 1];
}
}
if (!target) {
return null;
}
return wrap(target);
};
Snap.plugin = function (f) {
f(Snap, Element, Paper, glob);
};

View File

@ -527,6 +527,10 @@
<a href="#Snap.fragment" class="dr-method"><span>Snap.fragment()</span></a>
</li>
<li class="dr-lvl1">
<a href="#Snap.getElementByPoint" class="dr-method"><span>Snap.getElementByPoint()</span></a>
</li>
<li class="dr-lvl1">
<a href="#Snap.getRGB" class="dr-method"><span>Snap.getRGB()</span></a>
</li>
@ -3233,7 +3237,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 1384 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1384">&#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 1385 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1385">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.select-extra"></div>
@ -3293,7 +3297,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 1395 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1395">&#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 1396 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1396">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.selectAll-extra"></div>
@ -3353,7 +3357,7 @@ Parses given transform string into an array of transformations
<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 1491 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1491">&#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 1486 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1486">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.attr-extra"></div>
@ -3498,7 +3502,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1540 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1540">&#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 1535 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1535">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.getBBox-extra"></div>
@ -3680,7 +3684,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1584 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1584">&#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 1579 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1579">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.transform-extra"></div>
@ -3844,7 +3848,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1629 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1629">&#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 1624 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1624">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.parent-extra"></div>
@ -3886,7 +3890,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1641 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1641">&#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 1636 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1636">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.append-extra"></div>
@ -3946,7 +3950,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1647 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1647">&#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 1642 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1642">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.add-extra"></div>
@ -3971,7 +3975,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1669 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1669">&#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 1664 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1664">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.prepend-extra"></div>
@ -4031,7 +4035,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1684 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1684">&#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 1679 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1679">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.before-extra"></div>
@ -4091,7 +4095,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1700 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1700">&#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 1695 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1695">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.after-extra"></div>
@ -4151,7 +4155,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1715 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1715">&#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 1710 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1710">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.insertBefore-extra"></div>
@ -4211,7 +4215,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1730 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1730">&#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 1725 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1725">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.insertAfter-extra"></div>
@ -4271,7 +4275,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1743 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1743">&#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 1738 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1738">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.remove-extra"></div>
@ -4313,7 +4317,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1758 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1758">&#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 1753 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1753">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.select-extra"></div>
@ -4373,7 +4377,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1770 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1770">&#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 1765 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1765">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.selectAll-extra"></div>
@ -4435,7 +4439,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1788 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1788">&#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 1783 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1783">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.asPX-extra"></div>
@ -4498,7 +4502,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1803 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1803">&#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 1798 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1798">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.use-extra"></div>
@ -4540,7 +4544,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1832 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1832">&#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 1827 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1827">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.clone-extra"></div>
@ -4582,7 +4586,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<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 1912 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1912">&#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 1907 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1907">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.toDefs-extra"></div>
@ -4624,7 +4628,7 @@ console.log(el.attr("fill")); // #fc0</code></pre></section>
<article id="Element.pattern">
<header>
<h3 class="dr-method">Element.pattern(x, y, width, height)<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1942 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1942">&#x27ad;</a></h3>
<h3 class="dr-method">Element.pattern(x, y, width, height)<a href="#Element.pattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1937 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1937">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.pattern-extra"></div>
@ -4724,7 +4728,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 1983 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1983">&#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 1978 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#1978">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.marker-extra"></div>
@ -4811,7 +4815,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 2042 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2042">&#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 2037 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2037">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.animation-extra"></div>
@ -4880,7 +4884,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 2059 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2059">&#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 2054 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2054">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.inAnim-extra"></div>
@ -4974,7 +4978,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 2108 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2108">&#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 2103 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2103">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.animate-extra"></div>
@ -5135,7 +5139,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 2126 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2126">&#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 2121 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2121">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.stop-extra"></div>
@ -5177,7 +5181,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 2147 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2147">&#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 2142 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2142">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.animate-extra"></div>
@ -5246,7 +5250,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 2219 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2219">&#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 2214 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2214">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.data-extra"></div>
@ -5368,7 +5372,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 2244 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2244">&#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 2239 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2239">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.removeData-extra"></div>
@ -5429,7 +5433,7 @@ If key is not provided, removes all the data of the element.
<article id="undefined">
<header>
<h3 class="dr-method">undefined<a href="#undefined" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2260 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2260">&#x27ad;</a></h3>
<h3 class="dr-method">undefined<a href="#undefined" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2255 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2255">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="undefined-extra"></div>
@ -5471,7 +5475,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 2268 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2268">&#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 2263 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2263">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.innerSVG-extra"></div>
@ -5513,7 +5517,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 2307 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2307">&#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 2302 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2302">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.parse-extra"></div>
@ -5573,7 +5577,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 2330 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2330">&#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 2325 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2325">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Fragment.select-extra"></div>
@ -5598,7 +5602,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 2337 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2337">&#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 2332 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2332">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Fragment.selectAll-extra"></div>
@ -5623,7 +5627,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 2348 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2348">&#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 2343 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2343">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.fragment-extra"></div>
@ -5683,7 +5687,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 2549 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2549">&#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 2544 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2544">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.el-extra"></div>
@ -5773,7 +5777,7 @@ var c = paper.el("circle").attr({
<article id="Paper.rect">
<header>
<h3 class="dr-method">Paper.rect(x, y, width, height, [rx], [ry])<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2572 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2572">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.rect(x, y, width, height, [rx], [ry])<a href="#Paper.rect" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2567 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2567">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.rect-extra"></div>
@ -5873,7 +5877,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.circle">
<header>
<h3 class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2609 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2609">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.circle(x, y, r)<a href="#Paper.circle" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2604 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2604">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.circle-extra"></div>
@ -5961,7 +5965,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.image">
<header>
<h3 class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2641 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2641">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.image(src, x, y, width, height)<a href="#Paper.image" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2636 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2636">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.image-extra"></div>
@ -6083,7 +6087,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.ellipse">
<header>
<h3 class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2684 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2684">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.ellipse(x, y, rx, ry)<a href="#Paper.ellipse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2679 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2679">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.ellipse-extra"></div>
@ -6174,7 +6178,7 @@ var c = paper.rect(40, 40, 50, 50, 10);</code></pre></section>
<article id="Paper.path">
<header>
<h3 class="dr-method">Paper.path([pathString])<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2729 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2729">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.path([pathString])<a href="#Paper.path" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2724 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2724">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.path-extra"></div>
@ -6442,7 +6446,7 @@ Note: there is a special case when a path consists of only three commands: <code
<article id="Paper.g">
<header>
<h3 class="dr-method">Paper.g([varargs])<a href="#Paper.g" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2760 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2760">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.g([varargs])<a href="#Paper.g" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2755 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2755">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.g-extra"></div>
@ -6551,7 +6555,7 @@ g.add(c2, c1);</code></pre></section>
<article id="Paper.group">
<header>
<h3 class="dr-method">Paper.group()<a href="#Paper.group" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2766 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2766">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.group()<a href="#Paper.group" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2761 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2761">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.group-extra"></div>
@ -6576,7 +6580,7 @@ g.add(c2, c1);</code></pre></section>
<article id="Paper.text">
<header>
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2794 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2794">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2789 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2789">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.text-extra"></div>
@ -6665,7 +6669,7 @@ var t2 = paper.text(50, 50, ["S","n","a","p"]);</code></pre></section>
<article id="Paper.line">
<header>
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2822 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2822">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2817 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2817">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.line-extra"></div>
@ -6756,7 +6760,7 @@ var t2 = paper.text(50, 50, ["S","n","a","p"]);</code></pre></section>
<article id="Paper.polyline">
<header>
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2851 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2851">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2846 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2846">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.polyline-extra"></div>
@ -6868,7 +6872,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
<article id="Paper.polygon">
<header>
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2871 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2871">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2866 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2866">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.polygon-extra"></div>
@ -6893,7 +6897,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
<article id="Paper.gradient">
<header>
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2924 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2924">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2919 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2919">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.gradient-extra"></div>
@ -7091,7 +7095,7 @@ half the width, from black to white:
<article id="Paper.toString">
<header>
<h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2940 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2940">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2935 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2935">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.toString-extra"></div>
@ -7133,7 +7137,7 @@ half the width, from black to white:
<article id="Paper.clear">
<header>
<h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2958 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2958">&#x27ad;</a></h3>
<h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 2953 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2953">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.clear-extra"></div>
@ -7158,7 +7162,7 @@ half the width, from black to white:
<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 2989 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2989">&#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 2984 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#2984">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.ajax-extra"></div>
@ -7262,7 +7266,7 @@ half the width, from black to white:
<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 3035 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3035">&#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 3030 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3030">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.load-extra"></div>
@ -7305,6 +7309,91 @@ half the width, from black to white:
</div>
</section>
</article>
<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 3459 in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#3459">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.getElementByPoint-extra"></div>
<div class="dr-method">
<p>Returns you topmost element under given point.
</p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
<em class="dr-type-object">object</em>
<span class="dr-description">Snap element object</span>
</p>
<div class="topcoat-list__container">
<h3 class="topcoat-list__header">Parameters</h3>
<ol class="topcoat-list">
<li class="topcoat-list__item"><span class="dr-param">x</span>
<span class="dr-type"><em class="dr-type-number">number</em> </span>
<span class="dr-description">x coordinate from the top left corner of the window</span></li>
<li class="topcoat-list__item"><span class="dr-param">y</span>
<span class="dr-type"><em class="dr-type-number">number</em> </span>
<span class="dr-description">y coordinate from the top left corner of the window</span></li>
</ol>
</div>
<h3>Usage</h3>
<section class="code"><pre class="javascript code"><code data-language="javascript" class="language-javascript">Snap.getElementByPoint(mouseX, mouseY).attr({stroke: "#f00"});</code></pre></section>
</div>
</section>
</article>

View File

@ -1265,7 +1265,8 @@ var contains = glob.doc.contains || glob.doc.compareDocumentPosition ?
} :
function (a, b) {
if (b) {
while (b = b.parentNode) {
while (b) {
b = b.parentNode;
if (b == a) {
return true;
}
@ -1439,13 +1440,7 @@ function Element(el) {
this.type = el.tagName;
this.anims = {};
this._ = {
transform: [],
sx: 1,
sy: 1,
deg: 0,
dx: 0,
dy: 0,
dirty: 1
transform: []
};
el.snap = id;
hub[id] = this;
@ -1657,20 +1652,6 @@ function arrayFirstValue(arr) {
el.paper = this.paper;
return this;
};
/*\
* Element.appendTo
[ method ]
**
* Appends the current element to the given one
**
- el (Element) parent element to append to
= (Element) the child element
\*/
elproto.appendTo = function (el) {
el = wrap(el);
el.append(this);
return this;
};
/*\
* Element.prepend
[ method ]
@ -1686,20 +1667,6 @@ function arrayFirstValue(arr) {
el.paper = this.paper;
return this;
};
/*\
* Element.prependTo
[ method ]
**
* Prepends the current element to the given one
**
- el (Element) parent element to prepend to
= (Element) the child element
\*/
elproto.prependTo = function (el) {
el = wrap(el);
el.prepend(this);
return this;
};
/*\
* Element.before
[ method ]
@ -1817,7 +1784,7 @@ function arrayFirstValue(arr) {
if (value == null) {
value = this.attr(attr);
}
return unit2px(this, attr, value);
return +unit2px(this, attr, value);
};
// SIERRA Element.use(): I suggest adding a note about how to access the original element the returned <use> instantiates. It's a part of SVG with which ordinary web developers may be least familiar.
/*\
@ -3464,6 +3431,51 @@ eve.on("snap.util.getattr", function () {
return $(this.node, att);
}
});
var getOffset = function (elem) {
var box = elem.getBoundingClientRect(),
doc = elem.ownerDocument,
body = doc.body,
docElem = doc.documentElement,
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0,
top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop ) - clientTop,
left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft;
return {
y: top,
x: left
};
};
/*\
* Snap.getElementByPoint
[ method ]
**
* Returns you topmost element under given point.
**
= (object) Snap element object
- x (number) x coordinate from the top left corner of the window
- y (number) y coordinate from the top left corner of the window
> Usage
| Snap.getElementByPoint(mouseX, mouseY).attr({stroke: "#f00"});
\*/
Snap.getElementByPoint = function (x, y) {
var paper = this,
svg = paper.canvas,
target = glob.doc.elementFromPoint(x, y);
if (glob.win.opera && target.tagName == "svg") {
var so = getOffset(target),
sr = target.createSVGRect();
sr.x = x - so.x;
sr.y = y - so.y;
sr.width = sr.height = 1;
var hits = target.getIntersectionList(sr, null);
if (hits.length) {
target = hits[hits.length - 1];
}
}
if (!target) {
return null;
}
return wrap(target);
};
Snap.plugin = function (f) {
f(Snap, Element, Paper, glob);
};