Added new align module with two new methods for Element.

master
baranovs 2014-09-17 17:40:16 +10:00
parent 3dcca7c330
commit 141d7a7610
6 changed files with 254 additions and 70 deletions

View File

@ -42,6 +42,7 @@ module.exports = function(grunt) {
"./src/equal.js", "./src/equal.js",
"./src/mouse.js", "./src/mouse.js",
"./src/filter.js", "./src/filter.js",
"./src/align.js",
"./src/amd-footer.js" "./src/amd-footer.js"
] ]
} }

File diff suppressed because one or more lines are too long

96
dist/snap.svg.js vendored
View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// build: 2014-08-15 // build: 2014-09-17
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
@ -1345,7 +1345,6 @@ packageRGB = function (r, g, b, o) {
is(o, "finite") && (rgb.opacity = o); is(o, "finite") && (rgb.opacity = o);
return rgb; return rgb;
}; };
// SIERRA Clarify if Snap does not support consolidated HSLA/RGBA colors. E.g., can you specify a semi-transparent value for Snap.filter.shadow()?
/*\ /*\
* Snap.color * Snap.color
[ method ] [ method ]
@ -2578,6 +2577,7 @@ Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
} }
if (tstr instanceof Snap.Matrix) { if (tstr instanceof Snap.Matrix) {
this.matrix = tstr; this.matrix = tstr;
this._.transform = tstr.toTransformString();
} else { } else {
extractTransform(this, tstr); extractTransform(this, tstr);
} }
@ -7771,5 +7771,97 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}; };
}); });
// Copyright (c) 2014 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.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
var box = Snap._.box,
is = Snap.is,
firstLetter = /^[^a-z]*([tbmlrc])/i,
toString = function () {
return "T" + this.dx + "," + this.dy;
};
/*\
* Element.getAlign
[ method ]
**
* Returns shift needed to align the element relatively to given element.
* If no elements specified, parent `<svg>` container will be used.
- el (object) @optional alignment element
- way (string) one of six values: `"top"`, `"middle"`, `"bottom"`, `"left"`, `"center"`, `"right"`
= (object|string) Object in format `{dx: , dy: }` also has a string representation as a transformation string
> Usage
| el.transform(el.getAlign(el2, "top"));
* or
| var dy = el.getAlign(el2, "top").dy;
\*/
Element.prototype.getAlign = function (el, way) {
if (way == null && is(el, "string")) {
way = el;
el = null;
}
el = el || this.paper;
var bx = el.getBBox ? el.getBBox() : box(el),
bb = this.getBBox(),
out = {};
way = way && way.match(firstLetter);
way = way ? way[1].toLowerCase() : "c";
switch (way) {
case "t":
out.dx = 0;
out.dy = bx.y - bb.y;
break;
case "b":
out.dx = 0;
out.dy = bx.y2 - bb.y2;
break;
case "m":
out.dx = 0;
out.dy = bx.cy - bb.cy;
break;
case "l":
out.dx = bx.x - bb.x;
out.dy = 0;
break;
case "r":
out.dx = bx.x2 - bb.x2;
out.dy = 0;
break;
default:
out.dx = bx.cx - bb.cx;
out.dy = 0;
break;
}
out.toString = toString;
return out;
};
/*\
* Element.align
[ method ]
**
* Aligns the element relatively to given one via transformation.
* If no elements specified, parent `<svg>` container will be used.
- el (object) @optional alignment element
- way (string) one of six values: `"top"`, `"middle"`, `"bottom"`, `"left"`, `"center"`, `"right"`
= (object) this element
> Usage
| el.align(el2, "top");
* or
| el.align("middle");
\*/
Element.prototype.align = function (el, way) {
return this.transform("..." + this.getAlign(el, way));
};
});
return Snap; return Snap;
})); }));

View File

@ -1904,7 +1904,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<article id="Snap.color"> <article id="Snap.color">
<header> <header>
<h3 class="dr-method">Snap.color(clr)<a href="#Snap.color" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 577 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L577">&#x27ad;</a></h3> <h3 class="dr-method">Snap.color(clr)<a href="#Snap.color" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 576 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L576">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.color-extra"></div> <div class="extra" id="Snap.color-extra"></div>
@ -2056,7 +2056,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<article id="Snap.hsb2rgb"> <article id="Snap.hsb2rgb">
<header> <header>
<h3 class="dr-method">Snap.hsb2rgb(h, s, v)<a href="#Snap.hsb2rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 629 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L629">&#x27ad;</a></h3> <h3 class="dr-method">Snap.hsb2rgb(h, s, v)<a href="#Snap.hsb2rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 628 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L628">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.hsb2rgb-extra"></div> <div class="extra" id="Snap.hsb2rgb-extra"></div>
@ -2174,7 +2174,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<article id="Snap.hsl2rgb"> <article id="Snap.hsl2rgb">
<header> <header>
<h3 class="dr-method">Snap.hsl2rgb(h, s, l)<a href="#Snap.hsl2rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 665 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L665">&#x27ad;</a></h3> <h3 class="dr-method">Snap.hsl2rgb(h, s, l)<a href="#Snap.hsl2rgb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 664 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L664">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.hsl2rgb-extra"></div> <div class="extra" id="Snap.hsl2rgb-extra"></div>
@ -2292,7 +2292,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<article id="Snap.rgb2hsb"> <article id="Snap.rgb2hsb">
<header> <header>
<h3 class="dr-method">Snap.rgb2hsb(r, g, b)<a href="#Snap.rgb2hsb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 704 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L704">&#x27ad;</a></h3> <h3 class="dr-method">Snap.rgb2hsb(r, g, b)<a href="#Snap.rgb2hsb" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 703 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L703">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.rgb2hsb-extra"></div> <div class="extra" id="Snap.rgb2hsb-extra"></div>
@ -2402,7 +2402,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<article id="Snap.rgb2hsl"> <article id="Snap.rgb2hsl">
<header> <header>
<h3 class="dr-method">Snap.rgb2hsl(r, g, b)<a href="#Snap.rgb2hsl" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 737 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L737">&#x27ad;</a></h3> <h3 class="dr-method">Snap.rgb2hsl(r, g, b)<a href="#Snap.rgb2hsl" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 736 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L736">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.rgb2hsl-extra"></div> <div class="extra" id="Snap.rgb2hsl-extra"></div>
@ -2512,7 +2512,7 @@ paper.path(Snap.format("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']
<article id="Snap.parsePathString"> <article id="Snap.parsePathString">
<header> <header>
<h3 class="dr-method">Snap.parsePathString(pathString)<a href="#Snap.parsePathString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 771 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L771">&#x27ad;</a></h3> <h3 class="dr-method">Snap.parsePathString(pathString)<a href="#Snap.parsePathString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 770 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L770">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.parsePathString-extra"></div> <div class="extra" id="Snap.parsePathString-extra"></div>
@ -2573,7 +2573,7 @@ Parses given path string into an array of arrays of path segments
<article id="Snap.parseTransformString"> <article id="Snap.parseTransformString">
<header> <header>
<h3 class="dr-method">Snap.parseTransformString(TString)<a href="#Snap.parseTransformString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 824 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L824">&#x27ad;</a></h3> <h3 class="dr-method">Snap.parseTransformString(TString)<a href="#Snap.parseTransformString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 823 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L823">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.parseTransformString-extra"></div> <div class="extra" id="Snap.parseTransformString-extra"></div>
@ -2634,7 +2634,7 @@ Parses given transform string into an array of transformations
<article id="Snap.select"> <article id="Snap.select">
<header> <header>
<h3 class="dr-method">Snap.select(query)<a href="#Snap.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1084 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1084">&#x27ad;</a></h3> <h3 class="dr-method">Snap.select(query)<a href="#Snap.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1083 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1083">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.select-extra"></div> <div class="extra" id="Snap.select-extra"></div>
@ -2694,7 +2694,7 @@ Parses given transform string into an array of transformations
<article id="Snap.selectAll"> <article id="Snap.selectAll">
<header> <header>
<h3 class="dr-method">Snap.selectAll(query)<a href="#Snap.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1096 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1096">&#x27ad;</a></h3> <h3 class="dr-method">Snap.selectAll(query)<a href="#Snap.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1095 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1095">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.selectAll-extra"></div> <div class="extra" id="Snap.selectAll-extra"></div>
@ -2754,7 +2754,7 @@ Parses given transform string into an array of transformations
<article id="Element.node"> <article id="Element.node">
<header> <header>
<h3 class="dr-property">Element.node(…)<a href="#Element.node" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1158 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1158">&#x27ad;</a></h3> <h3 class="dr-property">Element.node(…)<a href="#Element.node" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1157 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1157">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.node-extra"></div> <div class="extra" id="Element.node-extra"></div>
@ -2805,7 +2805,7 @@ c.node.onclick = function () {
<article id="Element.type"> <article id="Element.type">
<header> <header>
<h3 class="dr-property">Element.type(…)<a href="#Element.type" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1168 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1168">&#x27ad;</a></h3> <h3 class="dr-property">Element.type(…)<a href="#Element.type" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1167 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1167">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.type-extra"></div> <div class="extra" id="Element.type-extra"></div>
@ -2830,7 +2830,7 @@ c.node.onclick = function () {
<article id="Element.attr"> <article id="Element.attr">
<header> <header>
<h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1210 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1210">&#x27ad;</a></h3> <h3 class="dr-method">Element.attr(…)<a href="#Element.attr" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1209 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1209">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.attr-extra"></div> <div class="extra" id="Element.attr-extra"></div>
@ -2989,7 +2989,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Snap.parse"> <article id="Snap.parse">
<header> <header>
<h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1241 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1241">&#x27ad;</a></h3> <h3 class="dr-method">Snap.parse(svg)<a href="#Snap.parse" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 1240 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1240">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.parse-extra"></div> <div class="extra" id="Snap.parse-extra"></div>
@ -3049,7 +3049,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Snap.fragment"> <article id="Snap.fragment">
<header> <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 1277 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1277">&#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 1276 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1276">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.fragment-extra"></div> <div class="extra" id="Snap.fragment-extra"></div>
@ -3109,7 +3109,7 @@ and <code>-</code>: <code>&quot;+=2em&quot;</code>.
<article id="Paper.el"> <article id="Paper.el">
<header> <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 1380 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1380">&#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 1379 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1379">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Paper.el-extra"></div> <div class="extra" id="Paper.el-extra"></div>
@ -3205,7 +3205,7 @@ var c = paper.el("circle", {
<article id="Snap.ajax"> <article id="Snap.ajax">
<header> <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 1498 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1498">&#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 1497 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1497">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.ajax-extra"></div> <div class="extra" id="Snap.ajax-extra"></div>
@ -3309,7 +3309,7 @@ var c = paper.el("circle", {
<article id="Snap.load"> <article id="Snap.load">
<header> <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 1544 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1544">&#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 1543 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1543">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.load-extra"></div> <div class="extra" id="Snap.load-extra"></div>
@ -3358,7 +3358,7 @@ var c = paper.el("circle", {
<article id="Snap.getElementByPoint"> <article id="Snap.getElementByPoint">
<header> <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 1575 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1575">&#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 1574 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1574">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.getElementByPoint-extra"></div> <div class="extra" id="Snap.getElementByPoint-extra"></div>
@ -3443,7 +3443,7 @@ var c = paper.el("circle", {
<article id="Snap.plugin"> <article id="Snap.plugin">
<header> <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 1610 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1610">&#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 1609 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L1609">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.plugin-extra"></div> <div class="extra" id="Snap.plugin-extra"></div>
@ -3752,16 +3752,16 @@ prototypes). This allow you to extend anything you want.
<p>or <p>or
</p> </p>
@ -3859,7 +3859,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.parent"> <article id="Element.parent">
<header> <header>
<h3 class="dr-method">Element.parent()<a href="#Element.parent" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 198 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L198">&#x27ad;</a></h3> <h3 class="dr-method">Element.parent()<a href="#Element.parent" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 199 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L199">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.parent-extra"></div> <div class="extra" id="Element.parent-extra"></div>
@ -3901,7 +3901,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.append"> <article id="Element.append">
<header> <header>
<h3 class="dr-method">Element.append(el)<a href="#Element.append" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 210 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L210">&#x27ad;</a></h3> <h3 class="dr-method">Element.append(el)<a href="#Element.append" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 211 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L211">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.append-extra"></div> <div class="extra" id="Element.append-extra"></div>
@ -3961,7 +3961,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.add"> <article id="Element.add">
<header> <header>
<h3 class="dr-method">Element.add()<a href="#Element.add" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 216 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L216">&#x27ad;</a></h3> <h3 class="dr-method">Element.add()<a href="#Element.add" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 217 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L217">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.add-extra"></div> <div class="extra" id="Element.add-extra"></div>
@ -3986,7 +3986,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.appendTo"> <article id="Element.appendTo">
<header> <header>
<h3 class="dr-method">Element.appendTo(el)<a href="#Element.appendTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 240 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L240">&#x27ad;</a></h3> <h3 class="dr-method">Element.appendTo(el)<a href="#Element.appendTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 241 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L241">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.appendTo-extra"></div> <div class="extra" id="Element.appendTo-extra"></div>
@ -4046,7 +4046,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.prepend"> <article id="Element.prepend">
<header> <header>
<h3 class="dr-method">Element.prepend(el)<a href="#Element.prepend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 256 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L256">&#x27ad;</a></h3> <h3 class="dr-method">Element.prepend(el)<a href="#Element.prepend" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 257 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L257">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.prepend-extra"></div> <div class="extra" id="Element.prepend-extra"></div>
@ -4106,7 +4106,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.prependTo"> <article id="Element.prependTo">
<header> <header>
<h3 class="dr-method">Element.prependTo(el)<a href="#Element.prependTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 290 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L290">&#x27ad;</a></h3> <h3 class="dr-method">Element.prependTo(el)<a href="#Element.prependTo" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 291 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L291">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.prependTo-extra"></div> <div class="extra" id="Element.prependTo-extra"></div>
@ -4166,7 +4166,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.before"> <article id="Element.before">
<header> <header>
<h3 class="dr-method">Element.before(el)<a href="#Element.before" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 304 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L304">&#x27ad;</a></h3> <h3 class="dr-method">Element.before(el)<a href="#Element.before" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 305 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L305">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.before-extra"></div> <div class="extra" id="Element.before-extra"></div>
@ -4226,7 +4226,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.after"> <article id="Element.after">
<header> <header>
<h3 class="dr-method">Element.after(el)<a href="#Element.after" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 332 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L332">&#x27ad;</a></h3> <h3 class="dr-method">Element.after(el)<a href="#Element.after" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 333 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L333">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.after-extra"></div> <div class="extra" id="Element.after-extra"></div>
@ -4257,7 +4257,6 @@ prototypes). This allow you to extend anything you want.
</ol> </ol>
</div> </div>
@ -4265,6 +4264,7 @@ prototypes). This allow you to extend anything you want.
@ -4286,7 +4286,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.insertBefore"> <article id="Element.insertBefore">
<header> <header>
<h3 class="dr-method">Element.insertBefore(el)<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 354 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L354">&#x27ad;</a></h3> <h3 class="dr-method">Element.insertBefore(el)<a href="#Element.insertBefore" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 355 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L355">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.insertBefore-extra"></div> <div class="extra" id="Element.insertBefore-extra"></div>
@ -4346,7 +4346,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.insertAfter"> <article id="Element.insertAfter">
<header> <header>
<h3 class="dr-method">Element.insertAfter(el)<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 372 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L372">&#x27ad;</a></h3> <h3 class="dr-method">Element.insertAfter(el)<a href="#Element.insertAfter" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 373 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L373">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.insertAfter-extra"></div> <div class="extra" id="Element.insertAfter-extra"></div>
@ -4406,7 +4406,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.remove"> <article id="Element.remove">
<header> <header>
<h3 class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 388 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L388">&#x27ad;</a></h3> <h3 class="dr-method">Element.remove()<a href="#Element.remove" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 389 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L389">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.remove-extra"></div> <div class="extra" id="Element.remove-extra"></div>
@ -4448,7 +4448,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.select"> <article id="Element.select">
<header> <header>
<h3 class="dr-method">Element.select(query)<a href="#Element.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 405 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L405">&#x27ad;</a></h3> <h3 class="dr-method">Element.select(query)<a href="#Element.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 406 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L406">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.select-extra"></div> <div class="extra" id="Element.select-extra"></div>
@ -4508,7 +4508,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.selectAll"> <article id="Element.selectAll">
<header> <header>
<h3 class="dr-method">Element.selectAll(query)<a href="#Element.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 418 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L418">&#x27ad;</a></h3> <h3 class="dr-method">Element.selectAll(query)<a href="#Element.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 419 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L419">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.selectAll-extra"></div> <div class="extra" id="Element.selectAll-extra"></div>
@ -4570,7 +4570,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.asPX"> <article id="Element.asPX">
<header> <header>
<h3 class="dr-method">Element.asPX(attr, [value])<a href="#Element.asPX" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 436 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L436">&#x27ad;</a></h3> <h3 class="dr-method">Element.asPX(attr, [value])<a href="#Element.asPX" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 437 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L437">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.asPX-extra"></div> <div class="extra" id="Element.asPX-extra"></div>
@ -4633,7 +4633,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.use"> <article id="Element.use">
<header> <header>
<h3 class="dr-method">Element.use()<a href="#Element.use" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 451 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L451">&#x27ad;</a></h3> <h3 class="dr-method">Element.use()<a href="#Element.use" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 452 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L452">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.use-extra"></div> <div class="extra" id="Element.use-extra"></div>
@ -4675,7 +4675,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.clone"> <article id="Element.clone">
<header> <header>
<h3 class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 542 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L542">&#x27ad;</a></h3> <h3 class="dr-method">Element.clone()<a href="#Element.clone" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 543 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L543">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.clone-extra"></div> <div class="extra" id="Element.clone-extra"></div>
@ -4717,7 +4717,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.toDefs"> <article id="Element.toDefs">
<header> <header>
<h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 559 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L559">&#x27ad;</a></h3> <h3 class="dr-method">Element.toDefs()<a href="#Element.toDefs" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 560 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L560">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toDefs-extra"></div> <div class="extra" id="Element.toDefs-extra"></div>
@ -4759,7 +4759,7 @@ prototypes). This allow you to extend anything you want.
<article id="Element.toPattern"> <article id="Element.toPattern">
<header> <header>
<h3 class="dr-method">Element.toPattern(x, y, width, height)<a href="#Element.toPattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 587 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L587">&#x27ad;</a></h3> <h3 class="dr-method">Element.toPattern(x, y, width, height)<a href="#Element.toPattern" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 588 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L588">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toPattern-extra"></div> <div class="extra" id="Element.toPattern-extra"></div>
@ -4859,7 +4859,7 @@ c.attr({
<article id="Element.marker"> <article id="Element.marker">
<header> <header>
<h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 628 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L628">&#x27ad;</a></h3> <h3 class="dr-method">Element.marker(x, y, width, height, refX, refY)<a href="#Element.marker" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 629 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L629">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.marker-extra"></div> <div class="extra" id="Element.marker-extra"></div>
@ -4946,7 +4946,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animation"> <article id="Snap.animation">
<header> <header>
<h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 687 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L687">&#x27ad;</a></h3> <h3 class="dr-method">Snap.animation(attr, duration, [easing], [callback])<a href="#Snap.animation" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 688 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L688">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.animation-extra"></div> <div class="extra" id="Snap.animation-extra"></div>
@ -5015,7 +5015,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Element.inAnim"> <article id="Element.inAnim">
<header> <header>
<h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 705 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L705">&#x27ad;</a></h3> <h3 class="dr-method">Element.inAnim()<a href="#Element.inAnim" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 706 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L706">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.inAnim-extra"></div> <div class="extra" id="Element.inAnim-extra"></div>
@ -5031,7 +5031,6 @@ To create a marker you have to specify the bounding rect and reference point:
@ -5040,6 +5039,7 @@ To create a marker you have to specify the bounding rect and reference point:
<p class="dr-returns"> <p class="dr-returns">
<strong class="dr-title">Returns:</strong> <strong class="dr-title">Returns:</strong>
@ -5117,7 +5117,7 @@ To create a marker you have to specify the bounding rect and reference point:
<article id="Snap.animate"> <article id="Snap.animate">
<header> <header>
<h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 755 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L755">&#x27ad;</a></h3> <h3 class="dr-method">Snap.animate(from, to, setter, duration, [easing], [callback])<a href="#Snap.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 756 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L756">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Snap.animate-extra"></div> <div class="extra" id="Snap.animate-extra"></div>
@ -5278,7 +5278,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.stop"> <article id="Element.stop">
<header> <header>
<h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 773 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L773">&#x27ad;</a></h3> <h3 class="dr-method">Element.stop()<a href="#Element.stop" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 774 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L774">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.stop-extra"></div> <div class="extra" id="Element.stop-extra"></div>
@ -5320,7 +5320,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.animate"> <article id="Element.animate">
<header> <header>
<h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 792 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L792">&#x27ad;</a></h3> <h3 class="dr-method">Element.animate(attrs, duration, [easing], [callback])<a href="#Element.animate" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 793 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L793">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.animate-extra"></div> <div class="extra" id="Element.animate-extra"></div>
@ -5389,7 +5389,7 @@ rect.animate({x: 10}, 1000);</code></pre></section>
<article id="Element.data"> <article id="Element.data">
<header> <header>
<h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 865 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L865">&#x27ad;</a></h3> <h3 class="dr-method">Element.data(key, [value])<a href="#Element.data" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 866 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L866">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.data-extra"></div> <div class="extra" id="Element.data-extra"></div>
@ -5428,11 +5428,11 @@ with <code>data-</code> attributes)
@ -5453,7 +5453,6 @@ with <code>data-</code> attributes)
</p> </p>
@ -5462,6 +5461,7 @@ with <code>data-</code> attributes)
@ -5511,7 +5511,7 @@ with <code>data-</code> attributes)
<article id="Element.removeData"> <article id="Element.removeData">
<header> <header>
<h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 894 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L894">&#x27ad;</a></h3> <h3 class="dr-method">Element.removeData([key])<a href="#Element.removeData" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 895 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L895">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.removeData-extra"></div> <div class="extra" id="Element.removeData-extra"></div>
@ -5572,7 +5572,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.outerSVG"> <article id="Element.outerSVG">
<header> <header>
<h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 911 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L911">&#x27ad;</a></h3> <h3 class="dr-method">Element.outerSVG()<a href="#Element.outerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 912 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L912">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.outerSVG-extra"></div> <div class="extra" id="Element.outerSVG-extra"></div>
@ -5615,7 +5615,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.toString"> <article id="Element.toString">
<header> <header>
<h3 class="dr-method">Element.toString()<a href="#Element.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 917 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L917">&#x27ad;</a></h3> <h3 class="dr-method">Element.toString()<a href="#Element.toString" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 918 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L918">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.toString-extra"></div> <div class="extra" id="Element.toString-extra"></div>
@ -5640,7 +5640,7 @@ If key is not provided, removes all the data of the element.
<article id="Element.innerSVG"> <article id="Element.innerSVG">
<header> <header>
<h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 925 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L925">&#x27ad;</a></h3> <h3 class="dr-method">Element.innerSVG()<a href="#Element.innerSVG" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 926 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L926">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Element.innerSVG-extra"></div> <div class="extra" id="Element.innerSVG-extra"></div>
@ -5682,7 +5682,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.select"> <article id="Fragment.select">
<header> <header>
<h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 972 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L972">&#x27ad;</a></h3> <h3 class="dr-method">Fragment.select()<a href="#Fragment.select" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 973 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L973">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Fragment.select-extra"></div> <div class="extra" id="Fragment.select-extra"></div>
@ -5707,7 +5707,7 @@ If key is not provided, removes all the data of the element.
<article id="Fragment.selectAll"> <article id="Fragment.selectAll">
<header> <header>
<h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 979 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L979">&#x27ad;</a></h3> <h3 class="dr-method">Fragment.selectAll()<a href="#Fragment.selectAll" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line 980 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L980">&#x27ad;</a></h3>
</header> </header>
<section> <section>
<div class="extra" id="Fragment.selectAll-extra"></div> <div class="extra" id="Fragment.selectAll-extra"></div>

92
src/align.js Normal file
View File

@ -0,0 +1,92 @@
// Copyright (c) 2014 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.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
Snap.plugin(function (Snap, Element, Paper, glob, Fragment) {
var box = Snap._.box,
is = Snap.is,
firstLetter = /^[^a-z]*([tbmlrc])/i,
toString = function () {
return "T" + this.dx + "," + this.dy;
};
/*\
* Element.getAlign
[ method ]
**
* Returns shift needed to align the element relatively to given element.
* If no elements specified, parent `<svg>` container will be used.
- el (object) @optional alignment element
- way (string) one of six values: `"top"`, `"middle"`, `"bottom"`, `"left"`, `"center"`, `"right"`
= (object|string) Object in format `{dx: , dy: }` also has a string representation as a transformation string
> Usage
| el.transform(el.getAlign(el2, "top"));
* or
| var dy = el.getAlign(el2, "top").dy;
\*/
Element.prototype.getAlign = function (el, way) {
if (way == null && is(el, "string")) {
way = el;
el = null;
}
el = el || this.paper;
var bx = el.getBBox ? el.getBBox() : box(el),
bb = this.getBBox(),
out = {};
way = way && way.match(firstLetter);
way = way ? way[1].toLowerCase() : "c";
switch (way) {
case "t":
out.dx = 0;
out.dy = bx.y - bb.y;
break;
case "b":
out.dx = 0;
out.dy = bx.y2 - bb.y2;
break;
case "m":
out.dx = 0;
out.dy = bx.cy - bb.cy;
break;
case "l":
out.dx = bx.x - bb.x;
out.dy = 0;
break;
case "r":
out.dx = bx.x2 - bb.x2;
out.dy = 0;
break;
default:
out.dx = bx.cx - bb.cx;
out.dy = 0;
break;
}
out.toString = toString;
return out;
};
/*\
* Element.align
[ method ]
**
* Aligns the element relatively to given one via transformation.
* If no elements specified, parent `<svg>` container will be used.
- el (object) @optional alignment element
- way (string) one of six values: `"top"`, `"middle"`, `"bottom"`, `"left"`, `"center"`, `"right"`
= (object) this element
> Usage
| el.align(el2, "top");
* or
| el.align("middle");
\*/
Element.prototype.align = function (el, way) {
return this.transform("..." + this.getAlign(el, way));
};
});

View File

@ -554,7 +554,6 @@ packageRGB = function (r, g, b, o) {
is(o, "finite") && (rgb.opacity = o); is(o, "finite") && (rgb.opacity = o);
return rgb; return rgb;
}; };
// SIERRA Clarify if Snap does not support consolidated HSLA/RGBA colors. E.g., can you specify a semi-transparent value for Snap.filter.shadow()?
/*\ /*\
* Snap.color * Snap.color
[ method ] [ method ]