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.
|
||||
:::
|
||||
```
|
||||
|
|
|
@ -11,7 +11,9 @@ sets the `data-rotate` property.
|
|||
Snippet snippet.rotate(rotation, overwrite=true)
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Snippet` object:::
|
||||
:::tip
|
||||
This method is chainable as it returns the `Snippet` object
|
||||
:::
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -19,20 +21,22 @@ Snippet snippet.rotate(rotation, overwrite=true)
|
|||
```js
|
||||
({ Point, Path, paths, Snippet, snippets, part }) => {
|
||||
|
||||
for (const i of [0,1,2,3,4,5,6]) {
|
||||
snippets[`demo${i}`] = new Snippet(
|
||||
"logo",
|
||||
new Point(60*i, 0)
|
||||
).rotate(60 * i)
|
||||
}
|
||||
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(-30,-50))
|
||||
.move(new Point(400,50))
|
||||
|
||||
return part
|
||||
for (const i of [0,1,2,3,4,5,6]) {
|
||||
snippets[`demo${i}`] = new Snippet(
|
||||
"logo",
|
||||
new Point(60*i, 0)
|
||||
).rotate(60 * i)
|
||||
}
|
||||
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(-30,-50))
|
||||
.move(new Point(400,50))
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
```
|
||||
|
|
|
@ -11,7 +11,9 @@ sets the `data-scale` property.
|
|||
Snippet snippet.scale(scale, overwrite=true)
|
||||
```
|
||||
|
||||
:::tipThis method is chainable as it returns the `Snippet` object:::
|
||||
:::tip
|
||||
This method is chainable as it returns the `Snippet` object
|
||||
:::
|
||||
|
||||
## Example
|
||||
|
||||
|
@ -19,20 +21,22 @@ Snippet snippet.scale(scale, overwrite=true)
|
|||
```js
|
||||
({ Point, Path, paths, Snippet, snippets, part }) => {
|
||||
|
||||
for (const i of [1,2,3,4,5,6]) {
|
||||
snippets[`demo${i}`] = new Snippet(
|
||||
"logo",
|
||||
new Point(30*i, 0)
|
||||
).scale(i/10)
|
||||
}
|
||||
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(0,-30))
|
||||
.move(new Point(200,20))
|
||||
|
||||
return part
|
||||
for (const i of [1,2,3,4,5,6]) {
|
||||
snippets[`demo${i}`] = new Snippet(
|
||||
"logo",
|
||||
new Point(30\*i, 0)
|
||||
).scale(i/10)
|
||||
}
|
||||
|
||||
// Prevent clipping
|
||||
paths.diag = new Path()
|
||||
.move(new Point(0,-30))
|
||||
.move(new Point(200,20))
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue