diff --git a/packages/plugintest/config/index.js b/packages/plugintest/config/index.js index dc257b93ad5..58b03493b24 100644 --- a/packages/plugintest/config/index.js +++ b/packages/plugintest/config/index.js @@ -56,7 +56,7 @@ export default { 'logo', 'measurements', 'mirror', - //'notches', + 'notches', //'round', //'scalebox', //'sprinkle', @@ -68,7 +68,7 @@ export default { ], options: { plugin: { - dflt: 'mirror', + dflt: 'notches', list: [ 'all', 'banner', diff --git a/packages/plugintest/src/index.js b/packages/plugintest/src/index.js index d60ba06e89a..f7658adcba4 100644 --- a/packages/plugintest/src/index.js +++ b/packages/plugintest/src/index.js @@ -14,7 +14,7 @@ import grainline from '@freesewing/plugin-grainline' import logo from '@freesewing/plugin-logo' import measurements from '@freesewing/plugin-measurements' import mirror from '@freesewing/plugin-mirror' -//import notches from '@freesewing/plugin-notches' +import notches from '@freesewing/plugin-notches' //import round from '@freesewing/plugin-round' //import scalebox from '@freesewing/plugin-scalebox' //import sprinkle from '@freesewing/plugin-sprinkle' @@ -36,7 +36,7 @@ import draftI18n from './plugin-i18n' import draftLogo from './plugin-logo' import draftMeasurements from './plugin-measurements' import draftMirror from './plugin-mirror' -//import draftNotches from './plugin-notches' +import draftNotches from './plugin-notches' //import draftRound from './plugin-round' //import draftScalebox from './plugin-scalebox' //import draftSprinkle from './plugin-sprinkle' @@ -64,7 +64,7 @@ const plugins = [ logo, measurements, mirror, -// notches, + notches, // round, // scalebox, // sprinkle, @@ -88,7 +88,7 @@ const methods = { draftLogo, draftMeasurements, draftMirror, -// draftNotches, + draftNotches, // draftRound, // draftScalebox, // draftSprinkle, diff --git a/packages/plugintest/src/plugin-notches.js b/packages/plugintest/src/plugin-notches.js new file mode 100644 index 00000000000..6b364aaa6d3 --- /dev/null +++ b/packages/plugintest/src/plugin-notches.js @@ -0,0 +1,31 @@ +const addThese = [ + 'notch', + 'bnotch', +] + +const draftNotches = part => { + + const { points, Point, paths, Path, snippets, Snippet, options } = part.shorthand() + + if (['notches', 'all'].indexOf(options.plugin) !== -1) { + + let x = 10 + for (const add of addThese) { + points[add] = new Point(x, 0) + snippets[add] = new Snippet(add, points[add]) + .attr('data-scale', options.buttonsScale) + .attr('data-rotate', options.buttonsRotate) + x += 20 + } + + // Prevent clipping of text + paths.box = new Path() + .move(new Point(0,-5)) + .line(new Point(20*addThese.length, 5)) + .attr('class', 'hidden') + } + + return part +} + +export default draftNotches