1
0
Fork 0

chore: Updated title macro docs

This commit is contained in:
joostdecock 2024-01-07 17:07:26 +01:00
parent 2d37cc6ee5
commit f674b870b9
3 changed files with 75 additions and 44 deletions

View file

@ -11,17 +11,26 @@ part of [core-plugins](/reference/plugins/core) (so it is available by default).
```js
macro('title', {
String id = 'title',
String align,
Boolean append,
String align = 'left',
Boolean append = false,
Point at,
Boolean cutlist
String nr,
String prefix,
Number rotation,
Number scale,
String title,
String brand = 'FreeSewing',
Boolean cutlist = true,
Number dy = 8,
Boolean force = false,
String id = 'title',
Mixed notes = false,
String nr,
Number rotation = 0,
Number scale = 1,
String title = 'plugin-annotations:noName',
classes = {
String date: 'text-sm fill-current',
String name: 'fill-note',
String notes: 'text-md fill-current',
String nr: 'text-4xl fill-note font-bold',
String title: 'text-lg fill-current font-bold',
}
})
```
@ -34,7 +43,7 @@ macro('title', {
// This is where name/version/etc. is supposed to be stored
store.set('data.version', 3)
store.set('data.name', 'Example')
store.set('data.for', 'Person')
store.set('data.for', 'Sorcha')
macro('title', {
nr: 9,
@ -45,7 +54,7 @@ macro('title', {
// Prevent clipping
paths.diag = new Path()
.move(new Point(-20,-50))
.move(new Point(80,35))
.move(new Point(120,35))
return part
}
@ -56,19 +65,30 @@ macro('title', {
| Property | Default | Type | Description |
| ----------:| :-----: | ------------------- | ----------- |
| `align' | 'left' | String | Horizontal text alignment. Valid values: 'left', 'right', 'center' |
| `append` | `false` | Boolean | Set this to `true` to append the `nr` to any text already set in Point `at`'s attributes, rather than overwrite it |
| `align` | `left` | String | Horizontal text alignment. One of `left`, `right`, or `center` |
| `append` | `false` | Boolean | Set this to `true` to append the `nr`, rather than overwrite it |
| `at` | | [Point](/reference/api/point) | The point at which to insert the title |
| `cutlist` | `true` | Boolean | Whether to include cutting instructions |
| `id` | `title` | `string` | The ID of this macro instance |
| `brand` | `FreeSewing` | String | Brand name will prefix the design name |
| `classes.date` | `text-sm fill-current` | String | CSS classes for the date |
| `classes.name` | `fill-note` | String | CSS classes for the name |
| `classes.notes` | `text-md fill-current` | String | CSS classes for the notes |
| `classes.nr` | `text-4xl fill-note font-bold` | String | CSS classes for the nr |
| `classes.title` | `text-lg fill-current font-bold` | String | CSS classes for the title |
| `cutlist` | `true` | Boolean | Set this to `true` to prepend notes with the cutting instructions |
| `dy` | `8` | Number | SVG-equivalent of line height, controls the vertical spacing between text lines |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
| `id` | `title` | `string` | The ID of this macro instance. See [Removing macros and the role of the macro id](/reference/macros#removing-macros-and-the-role-of-the-macro-id) |
| `notes` | | String | Any notes to go under the title |
| `nr` | | String | The number of the pattern part |
| `title` | | String | The name of the pattern part. If title is not set or is an empty string, this won't be rendered, and the version will go beneath the nr.|
| `rotation` | `0` | Number | Rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor to make the title bigger/smaller |
| `title` | `plugin-annotations:noName` | String | The name of the pattern part |
| `prefix` | | String | A prefix to add to the created points. This allow for more than 1 title per part, as long as you give them a different prefix.|
| `rotation` | 0 | Number | An optional rotation in degrees |
| `scale` | 1 | Number | An optional scaling factor |
| `force` | `false` | `boolean` | Set this to `true` to display the macro output even when `complete` is `false` |
## Notes
This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
- This macro takes the `complete` setting into account and won't output anything when both complete and `force` are `false`.
- This macro will check the value of `store.version` and `store.name` for the design version and name. These are auto-set by core.
- This macro will check the value of `store.for` for info of who this pattern was generated for. This is something to be done at run-time by your frontend.