fix(docs) Add custom attributes and Snippets documentation
This commit is contained in:
parent
265833d419
commit
b53f62c4d1
8 changed files with 116 additions and 17 deletions
|
@ -46,9 +46,11 @@ Path path.attr(
|
|||
## Notes
|
||||
|
||||
Methods like
|
||||
[`Path.addClass`](/reference/api/path/addclass),
|
||||
[`Path.setClass`](/reference/api/path/setclass),
|
||||
[`Path.adddText`](/reference/api/path/addtext), and
|
||||
[`Path.addClass`](/reference/api/path/addclass),
|
||||
[`Path.setClass`](/reference/api/path/setclass),
|
||||
[`Path.addText`](/reference/api/path/addtext), and
|
||||
[`Path.setText`](/reference/api/path/settext)
|
||||
all call this method under the hood.
|
||||
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Paths.
|
||||
|
|
|
@ -12,7 +12,7 @@ Path new Path()
|
|||
|
||||
The Path constructor takes no arguments.
|
||||
|
||||
## Attributes
|
||||
## Properties
|
||||
|
||||
A Path objects comes with the following properties:
|
||||
|
||||
|
@ -24,6 +24,10 @@ A Path objects comes with the following properties:
|
|||
[Path.setHidden()](/reference/api/path/sethidden) for various methods that
|
||||
allow setting this in a chainable way.
|
||||
|
||||
<Related>
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Paths.
|
||||
</Related>
|
||||
## Example
|
||||
|
||||
<Example caption="Example of the Path contructor">
|
||||
|
|
|
@ -42,3 +42,7 @@ If the third parameter is set to `true` it will call [`this.attributes.set()`](/
|
|||
```
|
||||
</Example>
|
||||
|
||||
## Notes
|
||||
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Points.
|
||||
|
|
|
@ -15,7 +15,7 @@ The point constructor takes two arguments:
|
|||
- `x` : The X-coordinate of the point
|
||||
- `y` : The Y-coordinate of the point
|
||||
|
||||
## Attributes
|
||||
## Properties
|
||||
|
||||
Point objects come with the following properties:
|
||||
|
||||
|
@ -23,6 +23,11 @@ Point objects come with the following properties:
|
|||
- `y` : The Y-coordinate of the point
|
||||
- `attributes` : An [Attributes](/reference/api/attributes) instance holding the point's attributes
|
||||
|
||||
<Related>
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Points.
|
||||
</Related>
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption="Example of the Point constructor">
|
||||
|
|
|
@ -41,3 +41,7 @@ Snippet snippet.attr(
|
|||
```
|
||||
</Example>
|
||||
|
||||
<Related>
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about what Attributes can be used with Snippets.
|
||||
</Related>
|
||||
|
|
|
@ -2,21 +2,22 @@
|
|||
title: Snippet
|
||||
---
|
||||
|
||||
A Snippet is a reuseable bit of markup for your pattern. They are added to the
|
||||
A Snippet is a reusable bit of markup for your pattern. Snippets are added to the
|
||||
SVG `defs` section, and rendered with the SVG `use` tag.
|
||||
|
||||
## Signature
|
||||
|
||||
```js
|
||||
Snippet new Snippet(def, Point);
|
||||
Snippet new Snippet(String def, Point anchor);
|
||||
```
|
||||
|
||||
The snippet constructor takes two arguments:
|
||||
|
||||
- `def` : The `xlink:href` id that links to the relevant entry in the SVG `defs` section
|
||||
- `def` : The `xlink:href` id that links to the relevant entry in the SVG `defs` section.
|
||||
This is also the common name of the snippet (`logo`, `notch`, `button`, etc.)
|
||||
- `anchor` : A [`Point`](/reference/api/point) on which to anchor the snippet
|
||||
|
||||
## Attributes
|
||||
## Properties
|
||||
|
||||
A Snippet object comes with the following properties:
|
||||
|
||||
|
@ -24,6 +25,11 @@ A Snippet object comes with the following properties:
|
|||
- `anchor` : A [`Point`](/reference/api/point) on which to anchor the snippet
|
||||
- `attributes` : An [`Attributes`](/reference/api/attributes) instance holding the snippet's attributes
|
||||
|
||||
<Related>
|
||||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about custom Attributes that can be used with Snippets.
|
||||
</Related>
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption="Example of the Snippet constructor">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue