@freesewing/plugin-sprinkle
Version:
A FreeSewing plugin to bulk-add snippets to your pattern
20 lines (17 loc) • 612 B
JavaScript
import about from '../about.json' with { type: 'json' }
export const plugin = {
name: about.id,
version: about.version,
macros: {
sprinkle: function (so, { snippets, Snippet, points }) {
for (let pid of so.on) {
snippets[pid + '-' + so.snippet] = new Snippet(so.snippet, points[pid])
if (so.scale) snippets[pid + '-' + so.snippet].attr('data-scale', so.scale)
if (so.rotate) snippets[pid + '-' + so.snippet].attr('data-rotate', so.rotate)
}
},
},
}
// More specifically named exports
export const sprinklePlugin = plugin
export const pluginSprinkle = plugin