Added support for gradients’ stops manipulation + url, deurl
parent
c31fad6ef9
commit
989b3f7c93
File diff suppressed because one or more lines are too long
|
@ -14,7 +14,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// build: 2017-01-18
|
||||
// build: 2017-01-24
|
||||
|
||||
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
|
||||
//
|
||||
|
@ -919,7 +919,6 @@ var has = "hasOwnProperty",
|
|||
ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
|
||||
colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,
|
||||
bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
|
||||
reURLValue = /^url\(#?([^)]+)\)$/,
|
||||
separator = Snap._.separator = /[,\s]+/,
|
||||
whitespace = /[\s]/g,
|
||||
commaSpaces = /[\s]*,[\s]*/,
|
||||
|
@ -4091,6 +4090,12 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
Str = String,
|
||||
separator = Snap._.separator,
|
||||
E = "";
|
||||
Snap.url = function (value) {
|
||||
return "url(" + value + ")";
|
||||
}
|
||||
Snap.deurl = function (value) {
|
||||
return String(value).match(reURLValue)[1];
|
||||
}
|
||||
// Attributes event handlers
|
||||
eve.on("snap.util.attr.mask", function (value) {
|
||||
if (value instanceof Element || value instanceof Fragment) {
|
||||
|
@ -4211,6 +4216,23 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
}
|
||||
return out;
|
||||
});
|
||||
var len = stops.length,
|
||||
start = 0,
|
||||
j = 0;
|
||||
function seed(i, end) {
|
||||
var step = (end - start) / (i - j);
|
||||
for (var k = j; k < i; k++) {
|
||||
stops[k].offset = +(+start + step * (k - j)).toFixed(2);
|
||||
}
|
||||
j = i;
|
||||
start = end;
|
||||
}
|
||||
len--;
|
||||
for (var i = 0; i < len; i++) if ("offset" in stops[i]) {
|
||||
seed(i, stops[i].offset);
|
||||
}
|
||||
stops[len].offset = stops[len].offset || 100;
|
||||
seed(len, stops[len].offset);
|
||||
return {
|
||||
type: type,
|
||||
params: params,
|
||||
|
@ -4443,6 +4465,22 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
eve.on("snap.util.getattr.#text", function () {
|
||||
return this.node.textContent;
|
||||
})(-1);
|
||||
eve.on("snap.util.getattr.fill", function (internal) {
|
||||
if (internal) {
|
||||
return;
|
||||
}
|
||||
eve.stop();
|
||||
var value = eve("snap.util.getattr.fill", this, true).firstDefined();
|
||||
return Snap("#" + Snap.deurl(value)) || value;
|
||||
})(-1);
|
||||
eve.on("snap.util.getattr.stroke", function (internal) {
|
||||
if (internal) {
|
||||
return;
|
||||
}
|
||||
eve.stop();
|
||||
var value = eve("snap.util.getattr.stroke", this, true).firstDefined();
|
||||
return Snap("#" + Snap.deurl(value)) || value;
|
||||
})(-1);
|
||||
eve.on("snap.util.getattr.viewBox", function () {
|
||||
eve.stop();
|
||||
var vb = $(this.node, "viewBox");
|
||||
|
@ -5230,21 +5268,51 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
(function () {
|
||||
var $ = Snap._.$;
|
||||
// gradients' helpers
|
||||
/*\
|
||||
* Element.stops()
|
||||
[ method ]
|
||||
**
|
||||
* Only for gradients!
|
||||
* Returns array of gradient stops elements.
|
||||
= (array) the stops array.
|
||||
\*/
|
||||
function Gstops() {
|
||||
return this.selectAll("stop");
|
||||
}
|
||||
/*\
|
||||
* Element.addStop()
|
||||
[ method ]
|
||||
**
|
||||
* Only for gradients!
|
||||
* Adds another stop to the gradient.
|
||||
- color (string) stops color
|
||||
- offset (number) stops offset 0..100
|
||||
= (object) gradient element
|
||||
\*/
|
||||
function GaddStop(color, offset) {
|
||||
var stop = $("stop"),
|
||||
attr = {
|
||||
offset: +offset + "%"
|
||||
};
|
||||
color = Snap.color(color);
|
||||
attr["stop-color"] = color.toString();
|
||||
attr["stop-color"] = color.hex;
|
||||
if (color.opacity < 1) {
|
||||
attr["stop-opacity"] = color.opacity;
|
||||
}
|
||||
$(stop, attr);
|
||||
this.node.appendChild(stop);
|
||||
var stops = this.stops(),
|
||||
inserted;
|
||||
for (var i = 0; i < stops.length; i++) {
|
||||
var stopOffset = stops[i].attr("offset");
|
||||
if (parseFloat(stopOffset) > offset) {
|
||||
this.node.insertBefore(stop, stops[i].node);
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!inserted) {
|
||||
this.node.appendChild(stop);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
function GgetBBox() {
|
||||
|
@ -5261,6 +5329,44 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
return Snap._.box(cx - r, cy - r, r * 2, r * 2);
|
||||
}
|
||||
}
|
||||
/*\
|
||||
* Element.setStops()
|
||||
[ method ]
|
||||
**
|
||||
* Only for gradients!
|
||||
* Updates stops of the gradient based on passed gradient descriptor. See @Ppaer.gradient
|
||||
- str (string) gradient descriptor part after `()`.
|
||||
= (object) gradient element
|
||||
| var g = paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff");
|
||||
| g.setStops("#fff-#000-#f00-#fc0");
|
||||
\*/
|
||||
function GsetStops(str) {
|
||||
var grad = str,
|
||||
stops = this.stops();
|
||||
if (typeof str == "string") {
|
||||
grad = eve("snap.util.grad.parse", null, "l(0,0,0,1)" + str).firstDefined().stops;
|
||||
}
|
||||
if (!Snap.is(grad, "array")) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < stops.length; i++) {
|
||||
if (grad[i]) {
|
||||
var color = Snap.color(grad[i].color),
|
||||
attr = {"offset": grad[i].offset + "%"};
|
||||
attr["stop-color"] = color.hex;
|
||||
if (color.opacity < 1) {
|
||||
attr["stop-opacity"] = color.opacity;
|
||||
}
|
||||
stops[i].attr(attr);
|
||||
} else {
|
||||
stops[i].remove();
|
||||
}
|
||||
}
|
||||
for (i = stops.length; i < grad.length; i++) {
|
||||
this.addStop(grad[i].color, grad[i].offset);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
function gradient(defs, str) {
|
||||
var grad = eve("snap.util.grad.parse", null, str).firstDefined(),
|
||||
el;
|
||||
|
@ -5279,24 +5385,8 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
});
|
||||
}
|
||||
var stops = grad.stops,
|
||||
len = stops.length,
|
||||
start = 0,
|
||||
j = 0;
|
||||
function seed(i, end) {
|
||||
var step = (end - start) / (i - j);
|
||||
for (var k = j; k < i; k++) {
|
||||
stops[k].offset = +(+start + step * (k - j)).toFixed(2);
|
||||
}
|
||||
j = i;
|
||||
start = end;
|
||||
}
|
||||
len--;
|
||||
for (var i = 0; i < len; i++) if ("offset" in stops[i]) {
|
||||
seed(i, stops[i].offset);
|
||||
}
|
||||
stops[len].offset = stops[len].offset || 100;
|
||||
seed(len, stops[len].offset);
|
||||
for (i = 0; i <= len; i++) {
|
||||
len = stops.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var stop = stops[i];
|
||||
el.addStop(stop.color, stop.offset);
|
||||
}
|
||||
|
@ -5307,6 +5397,7 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
el.stops = Gstops;
|
||||
el.addStop = GaddStop;
|
||||
el.getBBox = GgetBBox;
|
||||
el.setStops = GsetStops;
|
||||
if (x1 != null) {
|
||||
$(el.node, {
|
||||
x1: x1,
|
||||
|
|
|
@ -79,6 +79,10 @@
|
|||
<a href="#Element.addClass" class="dr-method"><span>Element.addClass()</span></a>
|
||||
</li>
|
||||
|
||||
<li class="dr-lvl1">
|
||||
<a href="#Element.addStop()" class="dr-method"><span>Element.addStop()()</span></a>
|
||||
</li>
|
||||
|
||||
<li class="dr-lvl1">
|
||||
<a href="#Element.after" class="dr-method"><span>Element.after()</span></a>
|
||||
</li>
|
||||
|
@ -235,10 +239,18 @@
|
|||
<a href="#Element.selectAll" class="dr-method"><span>Element.selectAll()</span></a>
|
||||
</li>
|
||||
|
||||
<li class="dr-lvl1">
|
||||
<a href="#Element.setStops()" class="dr-method"><span>Element.setStops()()</span></a>
|
||||
</li>
|
||||
|
||||
<li class="dr-lvl1">
|
||||
<a href="#Element.stop" class="dr-method"><span>Element.stop()</span></a>
|
||||
</li>
|
||||
|
||||
<li class="dr-lvl1">
|
||||
<a href="#Element.stops()" class="dr-method"><span>Element.stops()()</span></a>
|
||||
</li>
|
||||
|
||||
<li class="dr-lvl1">
|
||||
<a href="#Element.toDefs" class="dr-method"><span>Element.toDefs()</span></a>
|
||||
</li>
|
||||
|
@ -1018,7 +1030,7 @@
|
|||
|
||||
<article id="Snap.format">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.format(token, json)<a href="#Snap.format" title="Link to this section" class="dr-hash">⚓</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">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.format(token, json)<a href="#Snap.format" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 199 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L199">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.format-extra"></div>
|
||||
|
@ -1112,7 +1124,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.rad">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.rad(deg)<a href="#Snap.rad" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 290 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L290">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.rad(deg)<a href="#Snap.rad" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 289 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L289">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.rad-extra"></div>
|
||||
|
@ -1172,7 +1184,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.deg">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.deg(rad)<a href="#Snap.deg" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 299 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L299">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.deg(rad)<a href="#Snap.deg" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 298 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L298">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.deg-extra"></div>
|
||||
|
@ -1232,7 +1244,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.sin">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.sin(angle)<a href="#Snap.sin" title="Link to this section" class="dr-hash">⚓</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">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.sin(angle)<a href="#Snap.sin" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 307 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L307">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.sin-extra"></div>
|
||||
|
@ -1292,7 +1304,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.tan">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.tan(angle)<a href="#Snap.tan" title="Link to this section" class="dr-hash">⚓</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">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.tan(angle)<a href="#Snap.tan" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 318 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L318">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.tan-extra"></div>
|
||||
|
@ -1352,7 +1364,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.cos">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.cos(angle)<a href="#Snap.cos" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 330 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L330">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.cos(angle)<a href="#Snap.cos" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 329 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L329">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.cos-extra"></div>
|
||||
|
@ -1412,7 +1424,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.asin">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.asin(num)<a href="#Snap.asin" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 341 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L341">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.asin(num)<a href="#Snap.asin" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 340 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L340">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.asin-extra"></div>
|
||||
|
@ -1472,7 +1484,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.acos">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.acos(num)<a href="#Snap.acos" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 352 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L352">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.acos(num)<a href="#Snap.acos" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 351 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L351">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.acos-extra"></div>
|
||||
|
@ -1532,7 +1544,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.atan">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.atan(num)<a href="#Snap.atan" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 363 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L363">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.atan(num)<a href="#Snap.atan" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 362 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L362">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.atan-extra"></div>
|
||||
|
@ -1592,7 +1604,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.atan2">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.atan2(num)<a href="#Snap.atan2" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 374 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L374">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.atan2(num)<a href="#Snap.atan2" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 373 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L373">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.atan2-extra"></div>
|
||||
|
@ -1652,7 +1664,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.angle">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.angle(x1, y1, x2, y2, [x3], [y3])<a href="#Snap.angle" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 391 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L391">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.angle(x1, y1, x2, y2, [x3], [y3])<a href="#Snap.angle" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 390 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L390">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.angle-extra"></div>
|
||||
|
@ -1738,7 +1750,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.len">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.len(x1, y1, x2, y2)<a href="#Snap.len" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 404 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L404">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.len(x1, y1, x2, y2)<a href="#Snap.len" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 403 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L403">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.len-extra"></div>
|
||||
|
@ -1818,7 +1830,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.len2">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.len2(x1, y1, x2, y2)<a href="#Snap.len2" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 419 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L419">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.len2(x1, y1, x2, y2)<a href="#Snap.len2" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 418 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L418">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.len2-extra"></div>
|
||||
|
@ -1898,7 +1910,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.closestPoint">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.closestPoint(path, x, y)<a href="#Snap.closestPoint" title="Link to this section" class="dr-hash">⚓</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">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.closestPoint(path, x, y)<a href="#Snap.closestPoint" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 438 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L438">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.closestPoint-extra"></div>
|
||||
|
@ -1975,7 +1987,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.is">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.is(o, type)<a href="#Snap.is" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 495 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L495">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.is(o, type)<a href="#Snap.is" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 494 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L494">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.is-extra"></div>
|
||||
|
@ -2038,7 +2050,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.snapTo">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.snapTo(values, value, [tolerance])<a href="#Snap.snapTo" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 506 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L506">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.snapTo(values, value, [tolerance])<a href="#Snap.snapTo" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 505 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L505">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.snapTo-extra"></div>
|
||||
|
@ -2104,7 +2116,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.getRGB">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.getRGB(color)<a href="#Snap.getRGB" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 559 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L559">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.getRGB(color)<a href="#Snap.getRGB" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 558 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L558">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.getRGB-extra"></div>
|
||||
|
@ -2439,7 +2451,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.hsb">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.hsb(h, s, b)<a href="#Snap.hsb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 647 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L647">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.hsb(h, s, b)<a href="#Snap.hsb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 646 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L646">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.hsb-extra"></div>
|
||||
|
@ -2505,7 +2517,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.hsl">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.hsl(h, s, l)<a href="#Snap.hsl" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 660 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L660">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.hsl(h, s, l)<a href="#Snap.hsl" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 659 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L659">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.hsl-extra"></div>
|
||||
|
@ -2571,7 +2583,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.rgb">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.rgb(r, g, b)<a href="#Snap.rgb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 673 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L673">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.rgb(r, g, b)<a href="#Snap.rgb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 672 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L672">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.rgb-extra"></div>
|
||||
|
@ -2637,7 +2649,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.color">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.color(clr)<a href="#Snap.color" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 759 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L759">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.color(clr)<a href="#Snap.color" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 758 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L758">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.color-extra"></div>
|
||||
|
@ -2789,7 +2801,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.hsb2rgb">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.hsb2rgb(h, s, v)<a href="#Snap.hsb2rgb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 811 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L811">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.hsb2rgb(h, s, v)<a href="#Snap.hsb2rgb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 810 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L810">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.hsb2rgb-extra"></div>
|
||||
|
@ -2907,7 +2919,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.hsl2rgb">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.hsl2rgb(h, s, l)<a href="#Snap.hsl2rgb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 847 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L847">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.hsl2rgb(h, s, l)<a href="#Snap.hsl2rgb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 846 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L846">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.hsl2rgb-extra"></div>
|
||||
|
@ -3025,7 +3037,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.rgb2hsb">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.rgb2hsb(r, g, b)<a href="#Snap.rgb2hsb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 886 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L886">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.rgb2hsb(r, g, b)<a href="#Snap.rgb2hsb" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 885 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L885">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.rgb2hsb-extra"></div>
|
||||
|
@ -3135,7 +3147,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.rgb2hsl">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.rgb2hsl(r, g, b)<a href="#Snap.rgb2hsl" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 919 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L919">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.rgb2hsl(r, g, b)<a href="#Snap.rgb2hsl" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 918 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L918">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.rgb2hsl-extra"></div>
|
||||
|
@ -3245,7 +3257,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
|
|||
|
||||
<article id="Snap.parsePathString">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.parsePathString(pathString)<a href="#Snap.parsePathString" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 952 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L952">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.parsePathString(pathString)<a href="#Snap.parsePathString" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 951 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L951">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.parsePathString-extra"></div>
|
||||
|
@ -3306,7 +3318,7 @@ Parses given path string into an array of arrays of path segments
|
|||
|
||||
<article id="Snap.parseTransformString">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.parseTransformString(TString)<a href="#Snap.parseTransformString" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1005 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1005">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.parseTransformString(TString)<a href="#Snap.parseTransformString" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1004 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1004">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.parseTransformString-extra"></div>
|
||||
|
@ -3367,7 +3379,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">⚓</a><a class="dr-sourceline" title="Go to line 1265 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1265">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.select(query)<a href="#Snap.select" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1264 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1264">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.select-extra"></div>
|
||||
|
@ -3427,7 +3439,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">⚓</a><a class="dr-sourceline" title="Go to line 1277 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1277">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.selectAll(query)<a href="#Snap.selectAll" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1276 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1276">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.selectAll-extra"></div>
|
||||
|
@ -3487,7 +3499,7 @@ Parses given transform string into an array of transformations
|
|||
|
||||
<article id="Element.node">
|
||||
<header>
|
||||
<h3 class="dr-property">Element.node()<a href="#Element.node" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1339 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1339">➭</a></h3>
|
||||
<h3 class="dr-property">Element.node()<a href="#Element.node" title="Link to this section" class="dr-hash">⚓</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">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.node-extra"></div>
|
||||
|
@ -3538,7 +3550,7 @@ c.node.onclick = function () {
|
|||
|
||||
<article id="Element.type">
|
||||
<header>
|
||||
<h3 class="dr-property">Element.type()<a href="#Element.type" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1349 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1349">➭</a></h3>
|
||||
<h3 class="dr-property">Element.type()<a href="#Element.type" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1348 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1348">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.type-extra"></div>
|
||||
|
@ -3563,7 +3575,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">⚓</a><a class="dr-sourceline" title="Go to line 1391 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1391">➭</a></h3>
|
||||
<h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">⚓</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">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.attr-extra"></div>
|
||||
|
@ -3722,7 +3734,7 @@ and <code>-</code>: <code>"+=2em"</code>.
|
|||
|
||||
<article id="Snap.parse">
|
||||
<header>
|
||||
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1432 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1432">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1431 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1431">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.parse-extra"></div>
|
||||
|
@ -3782,7 +3794,7 @@ and <code>-</code>: <code>"+=2em"</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">⚓</a><a class="dr-sourceline" title="Go to line 1466 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1466">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.fragment(varargs)<a href="#Snap.fragment" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1465 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1465">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.fragment-extra"></div>
|
||||
|
@ -3842,7 +3854,7 @@ and <code>-</code>: <code>"+=2em"</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">⚓</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">➭</a></h3>
|
||||
<h3 class="dr-method">Paper.el(name, attr)<a href="#Paper.el" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1568 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1568">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Paper.el-extra"></div>
|
||||
|
@ -3938,7 +3950,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">⚓</a><a class="dr-sourceline" title="Go to line 1581 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1581">➭</a></h3>
|
||||
<h3 class="dr-method">Element.children()<a href="#Element.children" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1580 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1580">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.children-extra"></div>
|
||||
|
@ -3980,7 +3992,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">⚓</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">➭</a></h3>
|
||||
<h3 class="dr-method">Element.toJSON()<a href="#Element.toJSON" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1613 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1613">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.toJSON-extra"></div>
|
||||
|
@ -4066,7 +4078,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">⚓</a><a class="dr-sourceline" title="Go to line 1732 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1732">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.ajax(…)<a href="#Snap.ajax" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1731 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1731">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.ajax-extra"></div>
|
||||
|
@ -4170,7 +4182,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">⚓</a><a class="dr-sourceline" title="Go to line 1778 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1778">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.load(url, callback, [scope])<a href="#Snap.load" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1777 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1777">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.load-extra"></div>
|
||||
|
@ -4219,7 +4231,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">⚓</a><a class="dr-sourceline" title="Go to line 1809 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1809">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.getElementByPoint(x, y)<a href="#Snap.getElementByPoint" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1808 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1808">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.getElementByPoint-extra"></div>
|
||||
|
@ -4304,7 +4316,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">⚓</a><a class="dr-sourceline" title="Go to line 1844 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1844">➭</a></h3>
|
||||
<h3 class="dr-method">Snap.plugin(f)<a href="#Snap.plugin" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 1843 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1843">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Snap.plugin-extra"></div>
|
||||
|
@ -9073,13 +9085,193 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
|
|||
|
||||
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<article id="Element.stops()">
|
||||
<header>
|
||||
<h3 class="dr-method">Element.stops()()<a href="#Element.stops()" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 523 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L523">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.stops()-extra"></div>
|
||||
<div class="dr-method">
|
||||
|
||||
|
||||
|
||||
|
||||
<p>Only for gradients!
|
||||
Returns array of gradient stops elements.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="dr-returns">
|
||||
<strong class="dr-title">Returns:</strong>
|
||||
|
||||
<em class="dr-type-array">array</em>
|
||||
|
||||
<span class="dr-description">the stops array.</span>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<article id="Element.addStop()">
|
||||
<header>
|
||||
<h3 class="dr-method">Element.addStop()(color, offset)<a href="#Element.addStop()" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 536 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L536">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.addStop()-extra"></div>
|
||||
<div class="dr-method">
|
||||
|
||||
|
||||
|
||||
|
||||
<p>Only for gradients!
|
||||
Adds another stop to the gradient.
|
||||
</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">color</span>
|
||||
<span class="dr-type"><em class="dr-type-string">string</em> </span>
|
||||
<span class="dr-description">stops color</span></li>
|
||||
<li class="topcoat-list__item"><span class="dr-param">offset</span>
|
||||
<span class="dr-type"><em class="dr-type-number">number</em> </span>
|
||||
<span class="dr-description">stops offset 0..100</span></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="dr-returns">
|
||||
<strong class="dr-title">Returns:</strong>
|
||||
|
||||
<em class="dr-type-object">object</em>
|
||||
|
||||
<span class="dr-description">gradient element</span>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<article id="Element.setStops()">
|
||||
<header>
|
||||
<h3 class="dr-method">Element.setStops()(str)<a href="#Element.setStops()" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 587 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L587">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Element.setStops()-extra"></div>
|
||||
<div class="dr-method">
|
||||
|
||||
|
||||
|
||||
|
||||
<p>Only for gradients!
|
||||
Updates stops of the gradient based on passed gradient descriptor. See <a href="#Ppaer.gradient" class="dr-link">Ppaer.gradient</a>
|
||||
</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">str</span>
|
||||
<span class="dr-type"><em class="dr-type-string">string</em> </span>
|
||||
<span class="dr-description">gradient descriptor part after <code>()</code>.</span></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p class="dr-returns">
|
||||
<strong class="dr-title">Returns:</strong>
|
||||
|
||||
<em class="dr-type-object">object</em>
|
||||
|
||||
<span class="dr-description">gradient element</span>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section class="code"><pre class="javascript code"><code data-language="javascript" class="language-javascript">var g = paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff");
|
||||
g.setStops("#fff-#000-#f00-#fc0");</code></pre></section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
|
||||
<article id="Paper.gradient">
|
||||
<header>
|
||||
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 659 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L659">➭</a></h3>
|
||||
<h3 class="dr-method">Paper.gradient(gradient)<a href="#Paper.gradient" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 712 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L712">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Paper.gradient-extra"></div>
|
||||
|
@ -9277,7 +9469,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">⚓</a><a class="dr-sourceline" title="Go to line 675 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L675">➭</a></h3>
|
||||
<h3 class="dr-method">Paper.toString()<a href="#Paper.toString" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 728 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L728">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Paper.toString-extra"></div>
|
||||
|
@ -9319,7 +9511,7 @@ half the width, from black to white:
|
|||
|
||||
<article id="Paper.toDataURL">
|
||||
<header>
|
||||
<h3 class="dr-method">Paper.toDataURL()<a href="#Paper.toDataURL" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 695 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L695">➭</a></h3>
|
||||
<h3 class="dr-method">Paper.toDataURL()<a href="#Paper.toDataURL" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 748 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L748">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Paper.toDataURL-extra"></div>
|
||||
|
@ -9361,7 +9553,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">⚓</a><a class="dr-sourceline" title="Go to line 706 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L706">➭</a></h3>
|
||||
<h3 class="dr-method">Paper.clear()<a href="#Paper.clear" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 759 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L759">➭</a></h3>
|
||||
</header>
|
||||
<section>
|
||||
<div class="extra" id="Paper.clear-extra"></div>
|
||||
|
|
55
src/attr.js
55
src/attr.js
|
@ -23,6 +23,28 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
Str = String,
|
||||
separator = Snap._.separator,
|
||||
E = "";
|
||||
/*\
|
||||
* Snap.url()
|
||||
[ method ]
|
||||
**
|
||||
* Wraps path into `"url(<path>)"`.
|
||||
- value (string) path
|
||||
= (string) wrapped path
|
||||
\*/
|
||||
Snap.url = function (value) {
|
||||
return "url(" + value + ")";
|
||||
}
|
||||
/*\
|
||||
* Snap.deurl()
|
||||
[ method ]
|
||||
**
|
||||
* Unwraps path from `"url(<path>)"`.
|
||||
- value (string) url path
|
||||
= (string) unwrapped path
|
||||
\*/
|
||||
Snap.deurl = function (value) {
|
||||
return String(value).match(reURLValue)[1];
|
||||
}
|
||||
// Attributes event handlers
|
||||
eve.on("snap.util.attr.mask", function (value) {
|
||||
if (value instanceof Element || value instanceof Fragment) {
|
||||
|
@ -143,6 +165,23 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
}
|
||||
return out;
|
||||
});
|
||||
var len = stops.length,
|
||||
start = 0,
|
||||
j = 0;
|
||||
function seed(i, end) {
|
||||
var step = (end - start) / (i - j);
|
||||
for (var k = j; k < i; k++) {
|
||||
stops[k].offset = +(+start + step * (k - j)).toFixed(2);
|
||||
}
|
||||
j = i;
|
||||
start = end;
|
||||
}
|
||||
len--;
|
||||
for (var i = 0; i < len; i++) if ("offset" in stops[i]) {
|
||||
seed(i, stops[i].offset);
|
||||
}
|
||||
stops[len].offset = stops[len].offset || 100;
|
||||
seed(len, stops[len].offset);
|
||||
return {
|
||||
type: type,
|
||||
params: params,
|
||||
|
@ -375,6 +414,22 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
eve.on("snap.util.getattr.#text", function () {
|
||||
return this.node.textContent;
|
||||
})(-1);
|
||||
eve.on("snap.util.getattr.fill", function (internal) {
|
||||
if (internal) {
|
||||
return;
|
||||
}
|
||||
eve.stop();
|
||||
var value = eve("snap.util.getattr.fill", this, true).firstDefined();
|
||||
return Snap("#" + Snap.deurl(value)) || value;
|
||||
})(-1);
|
||||
eve.on("snap.util.getattr.stroke", function (internal) {
|
||||
if (internal) {
|
||||
return;
|
||||
}
|
||||
eve.stop();
|
||||
var value = eve("snap.util.getattr.stroke", this, true).firstDefined();
|
||||
return Snap("#" + Snap.deurl(value)) || value;
|
||||
})(-1);
|
||||
eve.on("snap.util.getattr.viewBox", function () {
|
||||
eve.stop();
|
||||
var vb = $(this.node, "viewBox");
|
||||
|
|
93
src/paper.js
93
src/paper.js
|
@ -512,21 +512,51 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
(function () {
|
||||
var $ = Snap._.$;
|
||||
// gradients' helpers
|
||||
/*\
|
||||
* Element.stops()
|
||||
[ method ]
|
||||
**
|
||||
* Only for gradients!
|
||||
* Returns array of gradient stops elements.
|
||||
= (array) the stops array.
|
||||
\*/
|
||||
function Gstops() {
|
||||
return this.selectAll("stop");
|
||||
}
|
||||
/*\
|
||||
* Element.addStop()
|
||||
[ method ]
|
||||
**
|
||||
* Only for gradients!
|
||||
* Adds another stop to the gradient.
|
||||
- color (string) stops color
|
||||
- offset (number) stops offset 0..100
|
||||
= (object) gradient element
|
||||
\*/
|
||||
function GaddStop(color, offset) {
|
||||
var stop = $("stop"),
|
||||
attr = {
|
||||
offset: +offset + "%"
|
||||
};
|
||||
color = Snap.color(color);
|
||||
attr["stop-color"] = color.toString();
|
||||
attr["stop-color"] = color.hex;
|
||||
if (color.opacity < 1) {
|
||||
attr["stop-opacity"] = color.opacity;
|
||||
}
|
||||
$(stop, attr);
|
||||
this.node.appendChild(stop);
|
||||
var stops = this.stops(),
|
||||
inserted;
|
||||
for (var i = 0; i < stops.length; i++) {
|
||||
var stopOffset = parseFloat(stops[i].attr("offset"));
|
||||
if (stopOffset > offset) {
|
||||
this.node.insertBefore(stop, stops[i].node);
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!inserted) {
|
||||
this.node.appendChild(stop);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
function GgetBBox() {
|
||||
|
@ -543,6 +573,44 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
return Snap._.box(cx - r, cy - r, r * 2, r * 2);
|
||||
}
|
||||
}
|
||||
/*\
|
||||
* Element.setStops()
|
||||
[ method ]
|
||||
**
|
||||
* Only for gradients!
|
||||
* Updates stops of the gradient based on passed gradient descriptor. See @Ppaer.gradient
|
||||
- str (string) gradient descriptor part after `()`.
|
||||
= (object) gradient element
|
||||
| var g = paper.gradient("l(0, 0, 1, 1)#000-#f00-#fff");
|
||||
| g.setStops("#fff-#000-#f00-#fc0");
|
||||
\*/
|
||||
function GsetStops(str) {
|
||||
var grad = str,
|
||||
stops = this.stops();
|
||||
if (typeof str == "string") {
|
||||
grad = eve("snap.util.grad.parse", null, "l(0,0,0,1)" + str).firstDefined().stops;
|
||||
}
|
||||
if (!Snap.is(grad, "array")) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < stops.length; i++) {
|
||||
if (grad[i]) {
|
||||
var color = Snap.color(grad[i].color),
|
||||
attr = {"offset": grad[i].offset + "%"};
|
||||
attr["stop-color"] = color.hex;
|
||||
if (color.opacity < 1) {
|
||||
attr["stop-opacity"] = color.opacity;
|
||||
}
|
||||
stops[i].attr(attr);
|
||||
} else {
|
||||
stops[i].remove();
|
||||
}
|
||||
}
|
||||
for (i = stops.length; i < grad.length; i++) {
|
||||
this.addStop(grad[i].color, grad[i].offset);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
function gradient(defs, str) {
|
||||
var grad = eve("snap.util.grad.parse", null, str).firstDefined(),
|
||||
el;
|
||||
|
@ -561,24 +629,8 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
});
|
||||
}
|
||||
var stops = grad.stops,
|
||||
len = stops.length,
|
||||
start = 0,
|
||||
j = 0;
|
||||
function seed(i, end) {
|
||||
var step = (end - start) / (i - j);
|
||||
for (var k = j; k < i; k++) {
|
||||
stops[k].offset = +(+start + step * (k - j)).toFixed(2);
|
||||
}
|
||||
j = i;
|
||||
start = end;
|
||||
}
|
||||
len--;
|
||||
for (var i = 0; i < len; i++) if ("offset" in stops[i]) {
|
||||
seed(i, stops[i].offset);
|
||||
}
|
||||
stops[len].offset = stops[len].offset || 100;
|
||||
seed(len, stops[len].offset);
|
||||
for (i = 0; i <= len; i++) {
|
||||
len = stops.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var stop = stops[i];
|
||||
el.addStop(stop.color, stop.offset);
|
||||
}
|
||||
|
@ -589,6 +641,7 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
|
|||
el.stops = Gstops;
|
||||
el.addStop = GaddStop;
|
||||
el.getBBox = GgetBBox;
|
||||
el.setStops = GsetStops;
|
||||
if (x1 != null) {
|
||||
$(el.node, {
|
||||
x1: x1,
|
||||
|
|
|
@ -76,7 +76,6 @@ var has = "hasOwnProperty",
|
|||
ISURL = /^url\(['"]?([^\)]+?)['"]?\)$/i,
|
||||
colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,
|
||||
bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,
|
||||
reURLValue = /^url\(#?([^)]+)\)$/,
|
||||
separator = Snap._.separator = /[,\s]+/,
|
||||
whitespace = /[\s]/g,
|
||||
commaSpaces = /[\s]*,[\s]*/,
|
||||
|
|
Loading…
Reference in New Issue