Added new method paper.use()
parent
3469abf423
commit
0f466e855d
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Snap.svg",
|
"name": "Snap.svg",
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"homepage": "http://snapsvg.io",
|
"homepage": "http://snapsvg.io",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Dmitry Baranovskiy <dmitry@baranovskiy.com>"
|
"Dmitry Baranovskiy <dmitry@baranovskiy.com>"
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
// Snap.svg 0.2.1
|
// Snap.svg 0.3.0
|
||||||
//
|
//
|
||||||
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
|
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
|
||||||
//
|
//
|
||||||
|
@ -771,7 +771,7 @@ var mina = (function (eve) {
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
var Snap = (function() {
|
var Snap = (function() {
|
||||||
Snap.version = "0.2.1";
|
Snap.version = "0.3.0";
|
||||||
/*\
|
/*\
|
||||||
* Snap
|
* Snap
|
||||||
[ method ]
|
[ method ]
|
||||||
|
@ -3762,6 +3762,31 @@ function gradientRadial(defs, cx, cy, r, fx, fy) {
|
||||||
el.attr(attrs);
|
el.attr(attrs);
|
||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
|
/*\
|
||||||
|
* Paper.use
|
||||||
|
[ method ]
|
||||||
|
**
|
||||||
|
* Creates a <use> element.
|
||||||
|
- id (string) @optional id of element to link
|
||||||
|
* or
|
||||||
|
- id (Element) @optional element to link
|
||||||
|
**
|
||||||
|
= (object) the `use` element
|
||||||
|
**
|
||||||
|
\*/
|
||||||
|
proto.use = function (id) {
|
||||||
|
var el = make("use", this.node);
|
||||||
|
if (id instanceof Element) {
|
||||||
|
if (!id.attr("id")) {
|
||||||
|
id.attr({id: ID()});
|
||||||
|
}
|
||||||
|
id = id.attr("id");
|
||||||
|
}
|
||||||
|
id && el.attr({
|
||||||
|
"xlink:href": id
|
||||||
|
});
|
||||||
|
return el;
|
||||||
|
};
|
||||||
/*\
|
/*\
|
||||||
* Paper.text
|
* Paper.text
|
||||||
[ method ]
|
[ method ]
|
||||||
|
|
|
@ -447,6 +447,10 @@
|
||||||
<a href="#Paper.toString" class="dr-method"><span>Paper.toString()</span></a>
|
<a href="#Paper.toString" class="dr-method"><span>Paper.toString()</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="dr-lvl1">
|
||||||
|
<a href="#Paper.use" class="dr-method"><span>Paper.use()</span></a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="dr-lvl0">
|
<li class="dr-lvl0">
|
||||||
<a href="#Set" class="undefined"><span>Set</span></a>
|
<a href="#Set" class="undefined"><span>Set</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -6951,13 +6955,102 @@ g.add(c2, c1);</code></pre></section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article id="Paper.use">
|
||||||
|
<header>
|
||||||
|
<h3 class="dr-method">Paper.use(…)<a href="#Paper.use" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3019 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3019">➭</a></h3>
|
||||||
|
</header>
|
||||||
|
<section>
|
||||||
|
<div class="extra" id="Paper.use-extra"></div>
|
||||||
|
<div class="dr-method">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>Creates a <use> element.
|
||||||
|
</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">id</span>
|
||||||
|
<span class="dr-type"><em class="dr-type-string">string</em> </span>
|
||||||
|
<span class="dr-description"><a href="#optional" class="dr-link">optional</a> id of element to link</span></li>
|
||||||
|
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p>or
|
||||||
|
</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">id</span>
|
||||||
|
<span class="dr-type"><em class="dr-type-Element">Element</em> </span>
|
||||||
|
<span class="dr-description"><a href="#optional" class="dr-link">optional</a> element to link</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">the <code>use</code> element</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article id="Paper.text">
|
<article id="Paper.text">
|
||||||
<header>
|
<header>
|
||||||
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3027 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3027">➭</a></h3>
|
<h3 class="dr-method">Paper.text(x, y, text)<a href="#Paper.text" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3052 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3052">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.text-extra"></div>
|
<div class="extra" id="Paper.text-extra"></div>
|
||||||
|
@ -7051,7 +7144,7 @@ t1.attr({textpath: pth});</code></pre></section>
|
||||||
|
|
||||||
<article id="Paper.line">
|
<article id="Paper.line">
|
||||||
<header>
|
<header>
|
||||||
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3055 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3055">➭</a></h3>
|
<h3 class="dr-method">Paper.line(x1, y1, x2, y2)<a href="#Paper.line" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3080 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3080">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.line-extra"></div>
|
<div class="extra" id="Paper.line-extra"></div>
|
||||||
|
@ -7142,7 +7235,7 @@ t1.attr({textpath: pth});</code></pre></section>
|
||||||
|
|
||||||
<article id="Paper.polyline">
|
<article id="Paper.polyline">
|
||||||
<header>
|
<header>
|
||||||
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3084 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3084">➭</a></h3>
|
<h3 class="dr-method">Paper.polyline(…)<a href="#Paper.polyline" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3109 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3109">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.polyline-extra"></div>
|
<div class="extra" id="Paper.polyline-extra"></div>
|
||||||
|
@ -7254,7 +7347,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
|
||||||
|
|
||||||
<article id="Paper.polygon">
|
<article id="Paper.polygon">
|
||||||
<header>
|
<header>
|
||||||
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3104 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3104">➭</a></h3>
|
<h3 class="dr-method">Paper.polygon()<a href="#Paper.polygon" title="Link to this section" class="dr-hash">⚓</a><a class="dr-sourceline" title="Go to line 3129 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3129">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.polygon-extra"></div>
|
<div class="extra" id="Paper.polygon-extra"></div>
|
||||||
|
@ -7279,7 +7372,7 @@ var p2 = paper.polyline(10, 10, 100, 100);</code></pre></section>
|
||||||
|
|
||||||
<article id="Paper.gradient">
|
<article id="Paper.gradient">
|
||||||
<header>
|
<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 3157 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3157">➭</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 3182 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3182">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.gradient-extra"></div>
|
<div class="extra" id="Paper.gradient-extra"></div>
|
||||||
|
@ -7477,7 +7570,7 @@ half the width, from black to white:
|
||||||
|
|
||||||
<article id="Paper.toString">
|
<article id="Paper.toString">
|
||||||
<header>
|
<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 3173 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3173">➭</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 3198 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3198">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.toString-extra"></div>
|
<div class="extra" id="Paper.toString-extra"></div>
|
||||||
|
@ -7519,7 +7612,7 @@ half the width, from black to white:
|
||||||
|
|
||||||
<article id="Paper.clear">
|
<article id="Paper.clear">
|
||||||
<header>
|
<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 3191 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3191">➭</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 3216 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3216">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Paper.clear-extra"></div>
|
<div class="extra" id="Paper.clear-extra"></div>
|
||||||
|
@ -7544,7 +7637,7 @@ half the width, from black to white:
|
||||||
|
|
||||||
<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">⚓</a><a class="dr-sourceline" title="Go to line 3222 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3222">➭</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 3247 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3247">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Snap.ajax-extra"></div>
|
<div class="extra" id="Snap.ajax-extra"></div>
|
||||||
|
@ -7648,7 +7741,7 @@ half the width, from black to white:
|
||||||
|
|
||||||
<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">⚓</a><a class="dr-sourceline" title="Go to line 3268 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3268">➭</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 3293 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3293">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Snap.load-extra"></div>
|
<div class="extra" id="Snap.load-extra"></div>
|
||||||
|
@ -7697,7 +7790,7 @@ half the width, from black to white:
|
||||||
|
|
||||||
<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">⚓</a><a class="dr-sourceline" title="Go to line 3765 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3765">➭</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 3790 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3790">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Snap.getElementByPoint-extra"></div>
|
<div class="extra" id="Snap.getElementByPoint-extra"></div>
|
||||||
|
@ -7782,7 +7875,7 @@ half the width, from black to white:
|
||||||
|
|
||||||
<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">⚓</a><a class="dr-sourceline" title="Go to line 3800 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3800">➭</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 3825 in the source" href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L3825">➭</a></h3>
|
||||||
</header>
|
</header>
|
||||||
<section>
|
<section>
|
||||||
<div class="extra" id="Snap.plugin-extra"></div>
|
<div class="extra" id="Snap.plugin-extra"></div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "snapsvg",
|
"name": "snapsvg",
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"description": "JavaScript Vector Library",
|
"description": "JavaScript Vector Library",
|
||||||
"main": "Gruntfile.js",
|
"main": "Gruntfile.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
27
src/svg.js
27
src/svg.js
|
@ -13,7 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
var Snap = (function() {
|
var Snap = (function() {
|
||||||
Snap.version = "0.2.1";
|
Snap.version = "0.3.0";
|
||||||
/*\
|
/*\
|
||||||
* Snap
|
* Snap
|
||||||
[ method ]
|
[ method ]
|
||||||
|
@ -3004,6 +3004,31 @@ function gradientRadial(defs, cx, cy, r, fx, fy) {
|
||||||
el.attr(attrs);
|
el.attr(attrs);
|
||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
|
/*\
|
||||||
|
* Paper.use
|
||||||
|
[ method ]
|
||||||
|
**
|
||||||
|
* Creates a <use> element.
|
||||||
|
- id (string) @optional id of element to link
|
||||||
|
* or
|
||||||
|
- id (Element) @optional element to link
|
||||||
|
**
|
||||||
|
= (object) the `use` element
|
||||||
|
**
|
||||||
|
\*/
|
||||||
|
proto.use = function (id) {
|
||||||
|
var el = make("use", this.node);
|
||||||
|
if (id instanceof Element) {
|
||||||
|
if (!id.attr("id")) {
|
||||||
|
id.attr({id: ID()});
|
||||||
|
}
|
||||||
|
id = id.attr("id");
|
||||||
|
}
|
||||||
|
id && el.attr({
|
||||||
|
"xlink:href": id
|
||||||
|
});
|
||||||
|
return el;
|
||||||
|
};
|
||||||
/*\
|
/*\
|
||||||
* Paper.text
|
* Paper.text
|
||||||
[ method ]
|
[ method ]
|
||||||
|
|
Loading…
Reference in New Issue