fix(dev): One-liner admonitions
This commit is contained in:
parent
a6d656c19e
commit
da41cc0fc9
60 changed files with 860 additions and 659 deletions
|
@ -3,7 +3,7 @@ title: Snippet.attr()
|
|||
---
|
||||
|
||||
The `Snippet.attr()` method can be used to add attributes to the Snippet
|
||||
object. It calls `this.attributes.add()` under the hood, and returns the
|
||||
object. It calls `this.attributes.add()` under the hood, and returns the
|
||||
Snippet object.
|
||||
|
||||
If the third parameter is set to `true` it will call `this.attributes.set()`
|
||||
|
@ -13,13 +13,15 @@ instead, thereby overwriting the value of the attribute.
|
|||
|
||||
```js
|
||||
Snippet snippet.attr(
|
||||
string name,
|
||||
mixed value,
|
||||
string name,
|
||||
mixed value,
|
||||
bool overwrite = false
|
||||
)
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Snippet` object:::
|
||||
:::tip
|
||||
This method is chainable as it returns the `Snippet` object
|
||||
:::
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -27,17 +29,18 @@ Snippet snippet.attr(
|
|||
```js
|
||||
({ Point, points, Path, paths, Snippet, snippets, part }) => {
|
||||
|
||||
snippets.logo = new Snippet('logo', new Point(0,0))
|
||||
.attr("data-scale", 0.75)
|
||||
.attr("data-rotate", 180)
|
||||
snippets.logo = new Snippet('logo', new Point(0,0))
|
||||
.attr("data-scale", 0.75)
|
||||
.attr("data-rotate", 180)
|
||||
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(-25,-10))
|
||||
.move(new Point(25,35))
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(-25,-10))
|
||||
.move(new Point(25,35))
|
||||
|
||||
return part
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
@ -45,3 +48,4 @@ Snippet snippet.attr(
|
|||
See [Using Attributes](/howtos/code/attributes)
|
||||
for information about what Attributes can be used with Snippets.
|
||||
:::
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue