diff --git a/markdown/dev/reference/api/macros/sprinkle/en.md b/markdown/dev/reference/api/macros/sprinkle/en.md index d7381830c86..0709557464e 100644 --- a/markdown/dev/reference/api/macros/sprinkle/en.md +++ b/markdown/dev/reference/api/macros/sprinkle/en.md @@ -5,7 +5,9 @@ title: sprinkle The `sprinkle` macro facilitates adding snippets to your pattern in bulk. It is by the [sprinkle plugin](/reference/plugins/sprinkle). - + +Example of button snippets sprinkled on a pattern by this macro + ```js macro('sprinkle', { @@ -18,5 +20,7 @@ macro('sprinkle', { |------------:|---------|------------------|-------------| | `snippet` | | String | Name of the snippet to sprinkle | | `on` | `[]` | Array of strings | An array with **the names** of points to add the snippet on | +| `scale` | 1 | number | Scale for the individual snippets | +| `rotate` | 0 | number | Rotation for the individual snippets | diff --git a/packages/plugin-sprinkle/src/index.js b/packages/plugin-sprinkle/src/index.js index 8e06c522605..4a68962c9e4 100644 --- a/packages/plugin-sprinkle/src/index.js +++ b/packages/plugin-sprinkle/src/index.js @@ -8,8 +8,11 @@ export default { }, macros: { sprinkle: function (so) { - for (let pid of so.on) + for (let pid of so.on) { this.snippets[pid + '-' + so.snippet] = new this.Snippet(so.snippet, this.points[pid]) - }, - }, + if (so.scale) this.snippets[pid + '-' + so.snippet].attr('data-scale', so.scale) + if (so.rotate) this.snippets[pid + '-' + so.snippet].attr('data-rotate', so.rotate) + } + } + } }