Added new method Paper.clear(). How I missed it? :)

master
Dmitry Baranovskiy 2013-10-21 02:46:25 +11:00
parent dc1866045a
commit bb3ba6e03c
4 changed files with 84 additions and 27 deletions

65
dist/reference.html vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

22
dist/snap.svg.js vendored
View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// build: 2013-10-20
// build: 2013-10-21
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@ -1116,7 +1116,7 @@ Snap.version = "0.1.0";
* Snap
[ method ]
**
* Creates a drawing surface or wraps existing SVG element
* Creates a drawing surface or wraps existing SVG element.
**
- width (number|string) width of surface
- height (number|string) height of surface
@ -3462,7 +3462,6 @@ function make(name, parent) {
el.type = name;
return el;
}
// SIERRA Is Paper() part of final interface, akin to Snap()? Document if so.
function Paper(w, h) {
var res,
desc,
@ -4042,6 +4041,23 @@ function gradientRadial(defs, cx, cy, r, fx, fy) {
f.removeChild(f.firstChild);
return res;
};
/*\
* Paper.clear
[ method ]
**
* Removes all child nodes of the paper, except <defs>.
\*/
proto.clear = function () {
var node = this.node.firstChild,
next;
while (node) {
next = node.nextSibling;
if (node.tagName != "defs") {
node.parentNode.removeChild(node);
}
node = next;
}
};
}());
}(Paper.prototype));

View File

@ -19,7 +19,7 @@ Snap.version = "0.1.0";
* Snap
[ method ]
**
* Creates a drawing surface or wraps existing SVG element
* Creates a drawing surface or wraps existing SVG element.
**
- width (number|string) width of surface
- height (number|string) height of surface
@ -2365,7 +2365,6 @@ function make(name, parent) {
el.type = name;
return el;
}
// SIERRA Is Paper() part of final interface, akin to Snap()? Document if so.
function Paper(w, h) {
var res,
desc,
@ -2945,6 +2944,23 @@ function gradientRadial(defs, cx, cy, r, fx, fy) {
f.removeChild(f.firstChild);
return res;
};
/*\
* Paper.clear
[ method ]
**
* Removes all child nodes of the paper, except <defs>.
\*/
proto.clear = function () {
var node = this.node.firstChild,
next;
while (node) {
next = node.nextSibling;
if (node.tagName != "defs") {
node.parentNode.removeChild(node);
}
node = next;
}
};
}());
}(Paper.prototype));