summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-10-11 15:20:01 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2015-10-11 15:20:01 +0200
commit79e050f93709ffa98c071ac9620d79d3d077c32d (patch)
treeca811db5e8fcb434e9363c1765061637e3a09dfb /README.md
parent412b37652b6695a6df4c214d7048275f2912dad7 (diff)
downloadsvg.js-79e050f93709ffa98c071ac9620d79d3d077c32d.tar.gz
svg.js-79e050f93709ffa98c071ac9620d79d3d077c32d.zip
added ungroup/flatten (#238), toParent and toDoc
Diffstat (limited to 'README.md')
-rw-r--r--README.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md
index 6562fd4..e69e6b0 100644
--- a/README.md
+++ b/README.md
@@ -1571,6 +1571,43 @@ rect.putIn(group) //-> returns group
__`returns`: `element`__
+### toParent()
+Moves an element to another parent (similar to add) but remains the visual representation. All transformations are merged and applied to the element.
+
+```javascript
+rect.toParent(group) // looks the same as before
+```
+
+__`returns`: `itself`__
+
+### toDoc()
+Same as `toParent()` but with the root-node as parent
+
+__`returns`: `itself`__
+
+### ungroup() / flatten()
+Break up the group/container and places all elements in the given parent while remaining their visual representation. The result is a flat svg structure e.g. for exporting
+
+```javascript
+// ungroups all elements in this group recursively and places them into the given parent
+// (default: parent container of the calling element)
+group.ungroup(parent, depth)
+
+// call it on the whole document to get a flat svg structure
+drawing.ungroup()
+
+// breaks up the group and places all elements in drawing
+group.ungroup(drawing)
+
+// breaks up all groups until it reaches a depth of 3
+drawing.ungroup(null, 3)
+
+// flat and export svg
+var svgString = drawing.ungroup().svg()
+```
+
+__`returns`: `itself`__
+
## Geometry
### viewbox()