Added missed doc for set

master
Dmitry Baranovskiy 2017-02-04 10:39:45 +11:00
parent 5433d225f6
commit fa62b7b152
5 changed files with 330 additions and 18 deletions

File diff suppressed because one or more lines are too long

60
dist/snap.svg.js vendored
View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
// build: 2017-02-03 // build: 2017-02-04
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// //
@ -853,7 +853,7 @@ var mina = (function (eve) {
return mina; return mina;
})(typeof eve == "undefined" ? function () {} : eve); })(typeof eve == "undefined" ? function () {} : eve);
// Copyright (c) 2013 - 2015 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 - 2017 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -7171,6 +7171,14 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
}); });
}; };
/*\
* Set.remove
[ method ]
**
* Removes all children of the set.
*
= (object) Set object
\*/
setproto.remove = function () { setproto.remove = function () {
while (this.length) { while (this.length) {
this.pop().remove(); this.pop().remove();
@ -7209,6 +7217,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return this; return this;
}; };
/*\
* Set.attr
[ method ]
**
* Equivalent of @Element.attr.
= (object) Set object
\*/
setproto.attr = function (value) { setproto.attr = function (value) {
var unbound = {}; var unbound = {};
for (var k in value) { for (var k in value) {
@ -7287,6 +7302,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return false; return false;
}; };
/*\
* Set.insertAfter
[ method ]
**
* Inserts set elements after given element.
**
- element (object) set will be inserted after this element
= (object) Set object
\*/
setproto.insertAfter = function (el) { setproto.insertAfter = function (el) {
var i = this.items.length; var i = this.items.length;
while (i--) { while (i--) {
@ -7294,6 +7318,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return this; return this;
}; };
/*\
* Set.getBBox
[ method ]
**
* Union of all bboxes of the set. See @Element.getBBox.
= (object) bounding box descriptor. See @Element.getBBox.
\*/
setproto.getBBox = function () { setproto.getBBox = function () {
var x = [], var x = [],
y = [], y = [],
@ -7321,6 +7352,14 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
cy: y + (y2 - y) / 2 cy: y + (y2 - y) / 2
}; };
}; };
/*\
* Set.insertAfter
[ method ]
**
* Creates a clone of the set.
**
= (object) New Set object
\*/
setproto.clone = function (s) { setproto.clone = function (s) {
s = new Set; s = new Set;
for (var i = 0, ii = this.items.length; i < ii; i++) { for (var i = 0, ii = this.items.length; i < ii; i++) {
@ -7333,7 +7372,24 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}; };
setproto.type = "set"; setproto.type = "set";
// export // export
/*\
* Snap.Set
[ property ]
**
* Set constructor.
\*/
Snap.Set = Set; Snap.Set = Set;
/*\
* Snap.set
[ method ]
**
* Creates a set and fills it with list of arguments.
**
= (object) New Set object
| var r = paper.rect(0, 0, 10, 10),
| s1 = Snap.set(), // empty set
| s2 = Snap.set(r, paper.circle(100, 100, 20)); // prefilled set
\*/
Snap.set = function () { Snap.set = function () {
var set = new Set; var set = new Set;
if (arguments.length) { if (arguments.length) {

View File

@ -635,6 +635,11 @@
<span>Set.animate()</span> <span>Set.animate()</span>
</a> </a>
</li> </li>
<li class="dr-lvl1">
<a href="#Set.attr" class="dr-method">
<span>Set.attr()</span>
</a>
</li>
<li class="dr-lvl1"> <li class="dr-lvl1">
<a href="#Set.bind" class="dr-method"> <a href="#Set.bind" class="dr-method">
<span>Set.bind()</span> <span>Set.bind()</span>
@ -655,6 +660,16 @@
<span>Set.forEach()</span> <span>Set.forEach()</span>
</a> </a>
</li> </li>
<li class="dr-lvl1">
<a href="#Set.getBBox" class="dr-method">
<span>Set.getBBox()</span>
</a>
</li>
<li class="dr-lvl1">
<a href="#Set.insertAfter" class="dr-method">
<span>Set.insertAfter()</span>
</a>
</li>
<li class="dr-lvl1"> <li class="dr-lvl1">
<a href="#Set.pop" class="dr-method"> <a href="#Set.pop" class="dr-method">
<span>Set.pop()</span> <span>Set.pop()</span>
@ -665,6 +680,11 @@
<span>Set.push()</span> <span>Set.push()</span>
</a> </a>
</li> </li>
<li class="dr-lvl1">
<a href="#Set.remove" class="dr-method">
<span>Set.remove()</span>
</a>
</li>
<li class="dr-lvl1"> <li class="dr-lvl1">
<a href="#Set.splice" class="dr-method"> <a href="#Set.splice" class="dr-method">
<span>Set.splice()</span> <span>Set.splice()</span>
@ -680,6 +700,11 @@
<span>Snap.Matrix()</span> <span>Snap.Matrix()</span>
</a> </a>
</li> </li>
<li class="dr-lvl1">
<a href="#Snap.Set" class="dr-property">
<span>Snap.Set</span>
</a>
</li>
<li class="dr-lvl1"> <li class="dr-lvl1">
<a href="#Snap.acos" class="dr-method"> <a href="#Snap.acos" class="dr-method">
<span>Snap.acos()</span> <span>Snap.acos()</span>
@ -995,6 +1020,11 @@
<span>Snap.selectAll()</span> <span>Snap.selectAll()</span>
</a> </a>
</li> </li>
<li class="dr-lvl1">
<a href="#Snap.set" class="dr-method">
<span>Snap.set()</span>
</a>
</li>
<li class="dr-lvl1"> <li class="dr-lvl1">
<a href="#Snap.sin" class="dr-method"> <a href="#Snap.sin" class="dr-method">
<span>Snap.sin()</span> <span>Snap.sin()</span>
@ -10162,13 +10192,36 @@ set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);</code></
</div> </div>
</section> </section>
</article> </article>
<article id="Set.remove">
<header>
<h3 class="dr-method">Set.remove()
<a href="#Set.remove" title="Link to this section"
class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 153 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L153">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="Set.remove-extra"></div>
<div class="dr-method">
<p>Removes all children of the set.
</p>
<p></p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
<em class="dr-type-object">object</em>
<span class="dr-description">Set object</span>
</p>
</div>
</section>
</article>
<article id="Set.bind"> <article id="Set.bind">
<header> <header>
<h3 class="dr-method">Set.bind(…) <h3 class="dr-method">Set.bind(…)
<a href="#Set.bind" title="Link to this section" <a href="#Set.bind" title="Link to this section"
class="dr-hash">&#x2693;</a> class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 170 in the source" <a class="dr-sourceline" title="Go to line 178 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L170">&#x27ad;</a> href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L178">&#x27ad;</a>
</h3> </h3>
</header> </header>
<section> <section>
@ -10257,13 +10310,36 @@ set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);</code></
</div> </div>
</section> </section>
</article> </article>
<article id="Set.attr">
<header>
<h3 class="dr-method">Set.attr()
<a href="#Set.attr" title="Link to this section"
class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 198 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L198">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="Set.attr-extra"></div>
<div class="dr-method">
<p>Equivalent of
<a href="#Element.attr" class="dr-link">Element.attr</a>.
</p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
<em class="dr-type-object">object</em>
<span class="dr-description">Set object</span>
</p>
</div>
</section>
</article>
<article id="Set.clear"> <article id="Set.clear">
<header> <header>
<h3 class="dr-method">Set.clear() <h3 class="dr-method">Set.clear()
<a href="#Set.clear" title="Link to this section" <a href="#Set.clear" title="Link to this section"
class="dr-hash">&#x2693;</a> class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 203 in the source" <a class="dr-sourceline" title="Go to line 218 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L203">&#x27ad;</a> href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L218">&#x27ad;</a>
</h3> </h3>
</header> </header>
<section> <section>
@ -10279,8 +10355,8 @@ set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);</code></
<h3 class="dr-method">Set.splice(index, count, [insertion…]) <h3 class="dr-method">Set.splice(index, count, [insertion…])
<a href="#Set.splice" <a href="#Set.splice"
title="Link to this section" class="dr-hash">&#x2693;</a> title="Link to this section" class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 219 in the source" <a class="dr-sourceline" title="Go to line 234 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L219">&#x27ad;</a> href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L234">&#x27ad;</a>
</h3> </h3>
</header> </header>
<section> <section>
@ -10327,8 +10403,8 @@ set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);</code></
<h3 class="dr-method">Set.exclude(element) <h3 class="dr-method">Set.exclude(element)
<a href="#Set.exclude" title="Link to this section" <a href="#Set.exclude" title="Link to this section"
class="dr-hash">&#x2693;</a> class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 254 in the source" <a class="dr-sourceline" title="Go to line 269 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L254">&#x27ad;</a> href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L269">&#x27ad;</a>
</h3> </h3>
</header> </header>
<section> <section>
@ -10357,6 +10433,130 @@ set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);</code></
</div> </div>
</section> </section>
</article> </article>
<article id="undefined">
<header>
<h3 class="dr-method">undefined
<a href="#undefined" title="Link to this section"
class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 285 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L285">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="undefined-extra"></div>
<div class="dr-method">
<p>Inserts set elements after given 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">element</span>
<span class="dr-type">
<em class="dr-type-object">object</em>
</span>
<span class="dr-description">set will be inserted after this element</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">Set object</span>
</p>
</div>
</section>
</article>
<article id="Set.getBBox">
<header>
<h3 class="dr-method">Set.getBBox()
<a href="#Set.getBBox" title="Link to this section"
class="dr-hash">&#x2693;</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">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="Set.getBBox-extra"></div>
<div class="dr-method">
<p>Union of all bboxes of the set. See
<a href="#Element.getBBox"
class="dr-link">Element.getBBox</a>.
</p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
<em class="dr-type-object">object</em>
<span class="dr-description">bounding box descriptor. See
<a href="#Element.getBBox"
class="dr-link">Element.getBBox</a>.</span>
</p>
</div>
</section>
</article>
<article id="Set.insertAfter">
<header>
<h3 class="dr-method">Set.insertAfter()
<a href="#Set.insertAfter" title="Link to this section"
class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 334 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L334">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="Set.insertAfter-extra"></div>
<div class="dr-method">
<p>Creates a clone of the set.
</p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
<em class="dr-type-object">object</em>
<span class="dr-description">New Set object</span>
</p>
</div>
</section>
</article>
<article id="Snap.Set">
<header>
<h3 class="dr-property">Snap.Set
<a href="#Snap.Set" title="Link to this section"
class="dr-hash">&#x2693;</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">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="Snap.Set-extra"></div>
<div class="dr-property">
<p>Set constructor.
</p>
</div>
</section>
</article>
<article id="Snap.set">
<header>
<h3 class="dr-method">Snap.set()
<a href="#Snap.set" title="Link to this section"
class="dr-hash">&#x2693;</a>
<a class="dr-sourceline" title="Go to line 364 in the source"
href="https://github.com/adobe-webplatform/Snap.svg/blob/master/src/svg.js#L364">&#x27ad;</a>
</h3>
</header>
<section>
<div class="extra" id="Snap.set-extra"></div>
<div class="dr-method">
<p>Creates a set and fills it with list of arguments.
</p>
<p class="dr-returns">
<strong class="dr-title">Returns:</strong>
<em class="dr-type-object">object</em>
<span class="dr-description">New Set object</span>
</p>
<section class="code"><pre class="javascript code"><code data-language="javascript" class="language-javascript">var r = paper.rect(0, 0, 10, 10),
s1 = Snap.set(), // empty set
s2 = Snap.set(r, paper.circle(100, 100, 20)); // prefilled set</code></pre></section>
</div>
</section>
</article>
<article id="Snap.mui"> <article id="Snap.mui">
<header> <header>
<h3 class="dr-property">Snap.mui() <h3 class="dr-property">Snap.mui()

View File

@ -142,6 +142,14 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
}); });
}; };
/*\
* Set.remove
[ method ]
**
* Removes all children of the set.
*
= (object) Set object
\*/
setproto.remove = function () { setproto.remove = function () {
while (this.length) { while (this.length) {
this.pop().remove(); this.pop().remove();
@ -180,6 +188,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return this; return this;
}; };
/*\
* Set.attr
[ method ]
**
* Equivalent of @Element.attr.
= (object) Set object
\*/
setproto.attr = function (value) { setproto.attr = function (value) {
var unbound = {}; var unbound = {};
for (var k in value) { for (var k in value) {
@ -258,6 +273,15 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return false; return false;
}; };
/*\
* Set.insertAfter
[ method ]
**
* Inserts set elements after given element.
**
- element (object) set will be inserted after this element
= (object) Set object
\*/
setproto.insertAfter = function (el) { setproto.insertAfter = function (el) {
var i = this.items.length; var i = this.items.length;
while (i--) { while (i--) {
@ -265,6 +289,13 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
} }
return this; return this;
}; };
/*\
* Set.getBBox
[ method ]
**
* Union of all bboxes of the set. See @Element.getBBox.
= (object) bounding box descriptor. See @Element.getBBox.
\*/
setproto.getBBox = function () { setproto.getBBox = function () {
var x = [], var x = [],
y = [], y = [],
@ -292,6 +323,14 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
cy: y + (y2 - y) / 2 cy: y + (y2 - y) / 2
}; };
}; };
/*\
* Set.insertAfter
[ method ]
**
* Creates a clone of the set.
**
= (object) New Set object
\*/
setproto.clone = function (s) { setproto.clone = function (s) {
s = new Set; s = new Set;
for (var i = 0, ii = this.items.length; i < ii; i++) { for (var i = 0, ii = this.items.length; i < ii; i++) {
@ -304,7 +343,24 @@ Snap.plugin(function (Snap, Element, Paper, glob) {
}; };
setproto.type = "set"; setproto.type = "set";
// export // export
/*\
* Snap.Set
[ property ]
**
* Set constructor.
\*/
Snap.Set = Set; Snap.Set = Set;
/*\
* Snap.set
[ method ]
**
* Creates a set and fills it with list of arguments.
**
= (object) New Set object
| var r = paper.rect(0, 0, 10, 10),
| s1 = Snap.set(), // empty set
| s2 = Snap.set(r, paper.circle(100, 100, 20)); // prefilled set
\*/
Snap.set = function () { Snap.set = function () {
var set = new Set; var set = new Set;
if (arguments.length) { if (arguments.length) {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2013 - 2015 Adobe Systems Incorporated. All rights reserved. // Copyright (c) 2013 - 2017 Adobe Systems Incorporated. All rights reserved.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.