Manual merge of PR #330, #328, #294, #282

master
Dmitry Baranovskiy 2015-04-02 22:06:19 +11:00
parent 0bd3b5b678
commit 69441e9849
6 changed files with 161 additions and 136 deletions

File diff suppressed because one or more lines are too long

58
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-10-28
// build: 2015-04-02
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
@ -2245,7 +2245,6 @@ Snap.parse = function (svg) {
while (svg.firstChild) {
f.appendChild(svg.firstChild);
}
div.innerHTML = E;
}
}
return new Fragment(f);
@ -6763,6 +6762,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
Snap.path.toString = toString;
Snap.path.clone = pathClone;
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -7158,6 +7158,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
return +val.toFixed(3) + unit;
};
}
function getViewBox(val) {
return val.join(" ");
}
function getColour(clr) {
return Snap.rgb(clr[0], clr[1], clr[2]);
}
@ -7183,16 +7186,25 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
return out;
}
function isNumeric(obj) {
return isFinite(parseFloat(obj));
}
function arrayEqual(arr1, arr2) {
if (!Snap.is(arr1, "array") || !Snap.is(arr2, "array")) {
return false;
}
return arr1.toString() == arr2.toString();
}
Element.prototype.equal = function (name, b) {
return eve("snap.util.equal", this, name, b).firstDefined();
};
eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""),
el = this;
if (a == +a && b == +b) {
if (isNumeric(a) && isNumeric(b)) {
return {
from: +a,
to: +b,
from: parseFloat(a),
to: parseFloat(b),
f: getNumber
};
}
@ -7205,6 +7217,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: getColour
};
}
if (name == "viewBox") {
A = this.attr(name).vb.split(" ").map(Number);
B = b.split(" ").map(Number);
return {
from: A,
to: B,
f: getViewBox
};
}
if (name == "transform" || name == "gradientTransform" || name == "patternTransform") {
if (b instanceof Snap.Matrix) {
b = b.toTransformString();
@ -7233,9 +7254,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: function (val) { return val; }
};
}
aUnit = a.match(reUnit);
var bUnit = Str(b).match(reUnit);
if (aUnit && aUnit == bUnit) {
var aUnit = a.match(reUnit),
bUnit = Str(b).match(reUnit);
if (aUnit && arrayEqual(aUnit, bUnit)) {
return {
from: parseFloat(a),
to: parseFloat(b),
@ -7333,25 +7354,6 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
return true;
};
};
} else if (glob.doc.attachEvent) {
return function (obj, type, fn, element) {
var f = function (e) {
e = e || element.node.ownerDocument.window.event;
var scrollY = getScroll("y", element),
scrollX = getScroll("x", element),
x = e.clientX + scrollX,
y = e.clientY + scrollY;
e.preventDefault = e.preventDefault || preventDefault;
e.stopPropagation = e.stopPropagation || stopPropagation;
return fn.call(element, e, x, y);
};
obj.attachEvent("on" + type, f);
var detacher = function () {
obj.detachEvent("on" + type, f);
return true;
};
return detacher;
};
}
})(),
drag = [],
@ -7749,6 +7751,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
return this;
};
});
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -8024,6 +8027,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
if (amount == null) {
amount = 1;
}
// <feColorMatrix type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0" color-interpolation-filters="sRGB"/>
return Snap.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>', {
amount: amount,
amount2: 1 - amount

View File

@ -1721,16 +1721,16 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<p>Returns distance between two points
</p>
<h3>Parameters</h3>
@ -2087,15 +2087,15 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<p>Parses color string as RGB object
</p>
<div class="topcoat-list__container">
<h3 class="topcoat-list__header">Parameters</h3>
@ -2142,15 +2142,15 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<li>#••• — shortened HTML color: (<code>#000</code>, <code>#fc0</code>, etc.)</li>
<li>#•••••• — full length HTML color: (<code>#000000</code>, <code>#bd2300</code>)</li>
@ -2190,15 +2190,15 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<li>rgb(•••%, •••%, •••%) — same as above, but in %: (<code>rgb(100%,&nbsp;175%,&nbsp;0%)</code>)</li>
<li>rgba(•••%, •••%, •••%, •••%) — also with opacity</li>
@ -2238,15 +2238,15 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<li>hsb(•••%, •••%, •••%) — same as above, but in %</li>
<li>hsba(•••%, •••%, •••%, •••%) — also with opacity</li>
@ -2321,19 +2321,19 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<p>Note that <code>%</code> can be used any time: <code>rgb(20%, 255, 50%)</code>.
</p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
@ -2817,10 +2817,10 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<span class="dr-description">RGB object in the following format:</span>
</p>
@ -3053,10 +3053,10 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<span class="dr-description">HSB object in the following format:</span>
</p>
@ -3310,8 +3310,7 @@ Parses given transform string into an array of transformations
</ol>
</div>
@ -3322,6 +3321,7 @@ Parses given transform string into an array of transformations
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
@ -3429,12 +3429,12 @@ Parses given transform string into an array of transformations
</ol>
</div>
@ -3483,9 +3483,9 @@ Parses given transform string into an array of transformations
<h3>Usage</h3>
@ -3597,13 +3597,13 @@ c.node.onclick = function () {
@ -3621,8 +3621,6 @@ c.node.onclick = function () {
<p>or
</p>
@ -3635,6 +3633,8 @@ c.node.onclick = function () {
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
@ -3754,7 +3754,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1470 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1470">&#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 1469 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1469">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.fragment-extra"></div>
@ -3814,7 +3814,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<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 1573 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1573">&#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 1572 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1572">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Paper.el-extra"></div>
@ -3910,7 +3910,7 @@ var c = paper.el("circle", {
<article id="Element.children">
<header>
<h3 class="dr-method">Element.children()<a href="#Element.children" 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.children()<a href="#Element.children" 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/Snap.svg/blob/master/src/svg.js#L1584">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.children-extra"></div>
@ -3952,7 +3952,7 @@ var c = paper.el("circle", {
<article id="Element.toJSON">
<header>
<h3 class="dr-method">Element.toJSON()<a href="#Element.toJSON" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1618 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1618">&#x27ad;</a></h3>
<h3 class="dr-method">Element.toJSON()<a href="#Element.toJSON" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1617 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1617">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.toJSON-extra"></div>
@ -4038,7 +4038,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 1736 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1736">&#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 1735 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1735">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.ajax-extra"></div>
@ -4142,7 +4142,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 1782 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1782">&#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 1781 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1781">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.load-extra"></div>
@ -4191,7 +4191,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 1813 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1813">&#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 1812 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1812">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.getElementByPoint-extra"></div>
@ -4276,7 +4276,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 1848 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1848">&#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 1847 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1847">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.plugin-extra"></div>
@ -5860,8 +5860,7 @@ To create a marker you have to specify the bounding rect and reference point:
<p>Returns a set of animations that may be able to manipulate the current element
</p>
@ -5873,6 +5872,7 @@ To create a marker you have to specify the bounding rect and reference point:
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
@ -6257,8 +6257,7 @@ with <code>data-</code> attributes)
</ol>
</div>
@ -6266,6 +6265,7 @@ with <code>data-</code> attributes)
@ -6284,12 +6284,12 @@ with <code>data-</code> attributes)
<p>or, if value is not specified:
</p>
@ -10849,7 +10849,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Snap.filter.brightness">
<header>
<h3 class="dr-method">Snap.filter.brightness(amount)<a href="#Snap.filter.brightness" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 293 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L293">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.filter.brightness(amount)<a href="#Snap.filter.brightness" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 294 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L294">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.filter.brightness-extra"></div>
@ -10909,7 +10909,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Snap.filter.contrast">
<header>
<h3 class="dr-method">Snap.filter.contrast(amount)<a href="#Snap.filter.contrast" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 313 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L313">&#x27ad;</a></h3>
<h3 class="dr-method">Snap.filter.contrast(amount)<a href="#Snap.filter.contrast" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 314 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L314">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Snap.filter.contrast-extra"></div>
@ -10969,7 +10969,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.click">
<header>
<h3 class="dr-method">Element.click(handler)<a href="#Element.click" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 166 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L166">&#x27ad;</a></h3>
<h3 class="dr-method">Element.click(handler)<a href="#Element.click" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 147 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L147">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.click-extra"></div>
@ -11029,7 +11029,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unclick">
<header>
<h3 class="dr-method">Element.unclick(handler)<a href="#Element.unclick" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 174 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L174">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unclick(handler)<a href="#Element.unclick" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 155 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L155">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unclick-extra"></div>
@ -11089,7 +11089,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.dblclick">
<header>
<h3 class="dr-method">Element.dblclick(handler)<a href="#Element.dblclick" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 183 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L183">&#x27ad;</a></h3>
<h3 class="dr-method">Element.dblclick(handler)<a href="#Element.dblclick" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 164 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L164">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.dblclick-extra"></div>
@ -11149,7 +11149,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.undblclick">
<header>
<h3 class="dr-method">Element.undblclick(handler)<a href="#Element.undblclick" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 191 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L191">&#x27ad;</a></h3>
<h3 class="dr-method">Element.undblclick(handler)<a href="#Element.undblclick" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 172 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L172">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.undblclick-extra"></div>
@ -11209,7 +11209,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.mousedown">
<header>
<h3 class="dr-method">Element.mousedown(handler)<a href="#Element.mousedown" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 200 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L200">&#x27ad;</a></h3>
<h3 class="dr-method">Element.mousedown(handler)<a href="#Element.mousedown" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 181 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L181">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.mousedown-extra"></div>
@ -11269,7 +11269,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unmousedown">
<header>
<h3 class="dr-method">Element.unmousedown(handler)<a href="#Element.unmousedown" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 208 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L208">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unmousedown(handler)<a href="#Element.unmousedown" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 189 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L189">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unmousedown-extra"></div>
@ -11329,7 +11329,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.mousemove">
<header>
<h3 class="dr-method">Element.mousemove(handler)<a href="#Element.mousemove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 217 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L217">&#x27ad;</a></h3>
<h3 class="dr-method">Element.mousemove(handler)<a href="#Element.mousemove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 198 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L198">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.mousemove-extra"></div>
@ -11389,7 +11389,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unmousemove">
<header>
<h3 class="dr-method">Element.unmousemove(handler)<a href="#Element.unmousemove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 225 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L225">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unmousemove(handler)<a href="#Element.unmousemove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 206 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L206">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unmousemove-extra"></div>
@ -11449,7 +11449,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.mouseout">
<header>
<h3 class="dr-method">Element.mouseout(handler)<a href="#Element.mouseout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 234 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L234">&#x27ad;</a></h3>
<h3 class="dr-method">Element.mouseout(handler)<a href="#Element.mouseout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 215 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L215">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.mouseout-extra"></div>
@ -11509,7 +11509,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unmouseout">
<header>
<h3 class="dr-method">Element.unmouseout(handler)<a href="#Element.unmouseout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 242 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L242">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unmouseout(handler)<a href="#Element.unmouseout" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 223 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L223">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unmouseout-extra"></div>
@ -11569,7 +11569,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.mouseover">
<header>
<h3 class="dr-method">Element.mouseover(handler)<a href="#Element.mouseover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 251 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L251">&#x27ad;</a></h3>
<h3 class="dr-method">Element.mouseover(handler)<a href="#Element.mouseover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 232 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L232">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.mouseover-extra"></div>
@ -11629,7 +11629,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unmouseover">
<header>
<h3 class="dr-method">Element.unmouseover(handler)<a href="#Element.unmouseover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 259 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L259">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unmouseover(handler)<a href="#Element.unmouseover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 240 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L240">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unmouseover-extra"></div>
@ -11689,7 +11689,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.mouseup">
<header>
<h3 class="dr-method">Element.mouseup(handler)<a href="#Element.mouseup" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 268 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L268">&#x27ad;</a></h3>
<h3 class="dr-method">Element.mouseup(handler)<a href="#Element.mouseup" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 249 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L249">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.mouseup-extra"></div>
@ -11749,7 +11749,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unmouseup">
<header>
<h3 class="dr-method">Element.unmouseup(handler)<a href="#Element.unmouseup" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 276 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L276">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unmouseup(handler)<a href="#Element.unmouseup" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 257 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L257">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unmouseup-extra"></div>
@ -11809,7 +11809,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.touchstart">
<header>
<h3 class="dr-method">Element.touchstart(handler)<a href="#Element.touchstart" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 285 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L285">&#x27ad;</a></h3>
<h3 class="dr-method">Element.touchstart(handler)<a href="#Element.touchstart" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 266 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L266">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.touchstart-extra"></div>
@ -11869,7 +11869,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.untouchstart">
<header>
<h3 class="dr-method">Element.untouchstart(handler)<a href="#Element.untouchstart" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 293 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L293">&#x27ad;</a></h3>
<h3 class="dr-method">Element.untouchstart(handler)<a href="#Element.untouchstart" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 274 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L274">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.untouchstart-extra"></div>
@ -11929,7 +11929,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.touchmove">
<header>
<h3 class="dr-method">Element.touchmove(handler)<a href="#Element.touchmove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 302 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L302">&#x27ad;</a></h3>
<h3 class="dr-method">Element.touchmove(handler)<a href="#Element.touchmove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 283 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L283">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.touchmove-extra"></div>
@ -11989,7 +11989,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.untouchmove">
<header>
<h3 class="dr-method">Element.untouchmove(handler)<a href="#Element.untouchmove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 310 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L310">&#x27ad;</a></h3>
<h3 class="dr-method">Element.untouchmove(handler)<a href="#Element.untouchmove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 291 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L291">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.untouchmove-extra"></div>
@ -12049,7 +12049,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.touchend">
<header>
<h3 class="dr-method">Element.touchend(handler)<a href="#Element.touchend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 319 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L319">&#x27ad;</a></h3>
<h3 class="dr-method">Element.touchend(handler)<a href="#Element.touchend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 300 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L300">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.touchend-extra"></div>
@ -12109,7 +12109,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.untouchend">
<header>
<h3 class="dr-method">Element.untouchend(handler)<a href="#Element.untouchend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 327 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L327">&#x27ad;</a></h3>
<h3 class="dr-method">Element.untouchend(handler)<a href="#Element.untouchend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 308 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L308">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.untouchend-extra"></div>
@ -12169,7 +12169,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.touchcancel">
<header>
<h3 class="dr-method">Element.touchcancel(handler)<a href="#Element.touchcancel" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 336 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L336">&#x27ad;</a></h3>
<h3 class="dr-method">Element.touchcancel(handler)<a href="#Element.touchcancel" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 317 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L317">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.touchcancel-extra"></div>
@ -12229,7 +12229,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.untouchcancel">
<header>
<h3 class="dr-method">Element.untouchcancel(handler)<a href="#Element.untouchcancel" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 344 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L344">&#x27ad;</a></h3>
<h3 class="dr-method">Element.untouchcancel(handler)<a href="#Element.untouchcancel" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 325 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L325">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.untouchcancel-extra"></div>
@ -12289,7 +12289,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.hover">
<header>
<h3 class="dr-method">Element.hover(f_in, f_out, [icontext], [ocontext])<a href="#Element.hover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 389 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L389">&#x27ad;</a></h3>
<h3 class="dr-method">Element.hover(f_in, f_out, [icontext], [ocontext])<a href="#Element.hover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 370 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L370">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.hover-extra"></div>
@ -12358,7 +12358,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.unhover">
<header>
<h3 class="dr-method">Element.unhover(f_in, f_out)<a href="#Element.unhover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 401 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L401">&#x27ad;</a></h3>
<h3 class="dr-method">Element.unhover(f_in, f_out)<a href="#Element.unhover" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 382 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L382">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.unhover-extra"></div>
@ -12421,7 +12421,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.drag">
<header>
<h3 class="dr-method">Element.drag(onmove, onstart, onend, [mcontext], [scontext], [econtext])<a href="#Element.drag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 439 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L439">&#x27ad;</a></h3>
<h3 class="dr-method">Element.drag(onmove, onstart, onend, [mcontext], [scontext], [econtext])<a href="#Element.drag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 420 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L420">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.drag-extra"></div>
@ -12640,7 +12640,7 @@ the classs presence or the value of the <code>flag</code> argument.
<article id="Element.undrag">
<header>
<h3 class="dr-method">Element.undrag()<a href="#Element.undrag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 488 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L488">&#x27ad;</a></h3>
<h3 class="dr-method">Element.undrag()<a href="#Element.undrag" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 469 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L469">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="Element.undrag-extra"></div>

View File

@ -78,6 +78,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
return +val.toFixed(3) + unit;
};
}
function getViewBox(val) {
return val.join(" ");
}
function getColour(clr) {
return Snap.rgb(clr[0], clr[1], clr[2]);
}
@ -103,16 +106,25 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}
return out;
}
function isNumeric(obj) {
return isFinite(parseFloat(obj));
}
function arrayEqual(arr1, arr2) {
if (!Snap.is(arr1, "array") || !Snap.is(arr2, "array")) {
return false;
}
return arr1.toString() == arr2.toString();
}
Element.prototype.equal = function (name, b) {
return eve("snap.util.equal", this, name, b).firstDefined();
};
eve.on("snap.util.equal", function (name, b) {
var A, B, a = Str(this.attr(name) || ""),
el = this;
if (a == +a && b == +b) {
if (isNumeric(a) && isNumeric(b)) {
return {
from: +a,
to: +b,
from: parseFloat(a),
to: parseFloat(b),
f: getNumber
};
}
@ -125,6 +137,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: getColour
};
}
if (name == "viewBox") {
A = this.attr(name).vb.split(" ").map(Number);
B = b.split(" ").map(Number);
return {
from: A,
to: B,
f: getViewBox
};
}
if (name == "transform" || name == "gradientTransform" || name == "patternTransform") {
if (b instanceof Snap.Matrix) {
b = b.toTransformString();
@ -153,9 +174,9 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
f: function (val) { return val; }
};
}
aUnit = a.match(reUnit);
var bUnit = Str(b).match(reUnit);
if (aUnit && aUnit == bUnit) {
var aUnit = a.match(reUnit),
bUnit = Str(b).match(reUnit);
if (aUnit && arrayEqual(aUnit, bUnit)) {
return {
from: parseFloat(a),
to: parseFloat(b),
@ -169,4 +190,4 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
};
}
});
});
});

View File

@ -273,6 +273,7 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
if (amount == null) {
amount = 1;
}
// <feColorMatrix type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0" color-interpolation-filters="sRGB"/>
return Snap.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>', {
amount: amount,
amount2: 1 - amount

View File

@ -1,4 +1,4 @@
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// Copyright (c) 2013 - 2015 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -1449,7 +1449,6 @@ Snap.parse = function (svg) {
while (svg.firstChild) {
f.appendChild(svg.firstChild);
}
div.innerHTML = E;
}
}
return new Fragment(f);