From: wout Date: Sat, 1 Feb 2014 13:43:06 +0000 (+0100) Subject: Updated README X-Git-Tag: 1.0.0-rc.4~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3b5c16a1ab20d2e2b16c80f448aa5897f3ecb386;p=svg.js.git Updated README --- diff --git a/README.md b/README.md index c20c268..211d51f 100644 --- a/README.md +++ b/README.md @@ -561,6 +561,7 @@ var group = draw.group() draw.index(rect) //-> returns 0 group.index(rect) //-> returns -1 ``` +###### `returns`: a number equal to or higher than `0`, `-1` if not found ### get() Get an element on a given position in the children array: @@ -572,6 +573,15 @@ var circle = draw.circle(50) draw.get(0) //-> returns rect draw.get(1) //-> returns circle ``` +###### `returns`: an element + +### clear() +To remove all elements from a parent element: + +```javascript +draw.clear() +``` +###### `returns`: itself ## Manipulating elements @@ -856,24 +866,29 @@ This method also acts as a getter: rect.height() //-> returns 325 ``` - -### hide(), show() and visible() -We all love to have a little hide: +### hide() +Hide element: ```javascript rect.hide() ``` +###### `returns`: itself -and show: +### show() +Show element: ```javascript rect.show() ``` +###### `returns`: itself +### visible() To check if the element is visible: + ```javascript rect.visible() ``` +###### `returns`: `true` or `false` ### clone() To make an exact copy of an element the `clone()` method comes in handy: @@ -881,23 +896,17 @@ To make an exact copy of an element the `clone()` method comes in handy: ```javascript var clone = rect.clone() ``` +###### `returns`: a new element This will create an new, unlinked copy. If you want to make a linked clone have a look at the [use](#elements/use) element. - ### remove() Pretty straightforward: ```javascript rect.remove() ``` - -### clear() -To remove all elements from a parent element: - -```javascript -draw.clear() -``` +###### `returns`: itself ### replace() This method will replace the called element with the given element in the same position in the stack: @@ -905,6 +914,7 @@ This method will replace the called element with the given element in the same p ```javascript rect.replace(draw.circle(100)) ``` +###### `returns`: the element passed as argument ## Inserting elements