diff --git a/packages/plugintest/config/index.js b/packages/plugintest/config/index.js index abfb207e449..779e30f3b6e 100644 --- a/packages/plugintest/config/index.js +++ b/packages/plugintest/config/index.js @@ -24,14 +24,19 @@ export default { 'bartackWidth', 'bartackStart', 'bartackEnd', - ] + ], + cutonfold: [ + 'cutonfoldMargin', + 'cutonfoldOffset', + 'cutonfoldGrainline', + ], }, measurements: [], parts: [ 'banner', 'bartack', 'buttons', - //'cutonfold', + 'cutonfold', //'dimension', //'flip', //'gore', @@ -52,7 +57,7 @@ export default { ], options: { plugin: { - dflt: 'buttons', + dflt: 'cutonfold', list: [ 'banner', 'bartack', @@ -88,5 +93,9 @@ export default { bartackWidth: {count: 3, min: 1, max: 5 }, bartackStart: {pct: 25, min: 0, max: 100 }, bartackEnd: {pct: 75, min: 0, max: 100 }, + // Cutonfold options + cutonfoldMargin: { count: 5, min: 0, max: 25 }, + cutonfoldOffset: { count: 15, min: 0, max: 100 }, + cutonfoldGrainline: { bool: false }, }, } diff --git a/packages/plugintest/src/index.js b/packages/plugintest/src/index.js index a72564c28c3..785c516b21c 100644 --- a/packages/plugintest/src/index.js +++ b/packages/plugintest/src/index.js @@ -4,7 +4,7 @@ import config from '../config' import banner from '@freesewing/plugin-banner' import bartack from '@freesewing/plugin-bartack' import buttons from '@freesewing/plugin-buttons' -//import cutonfold from '@freesewing/plugin-cutonfold' +import cutonfold from '@freesewing/plugin-cutonfold' //import dimension from '@freesewing/plugin-dimension' //import flip from '@freesewing/plugin-flip' //import gore from '@freesewing/plugin-gore' @@ -26,7 +26,7 @@ import buttons from '@freesewing/plugin-buttons' import draftBanner from './plugin-banner' import draftBartack from './plugin-bartack' import draftButtons from './plugin-buttons' -//import draftCutonfold from './plugin-cutonfold' +import draftCutonfold from './plugin-cutonfold' //import draftDimension from './plugin-dimension' //import draftFlip from './plugin-flip' //import draftGore from './plugin-gore' @@ -53,7 +53,7 @@ const plugins = [ banner, bartack, buttons, -// cutonfold, + cutonfold, // dimension, // flip, // gore, @@ -77,7 +77,7 @@ const methods = { draftBanner, draftBartack, draftButtons, -// draftCutonfold, + draftCutonfold, // draftDimension, // draftFlip, // draftGore, diff --git a/packages/plugintest/src/plugin-cutonfold.js b/packages/plugintest/src/plugin-cutonfold.js new file mode 100644 index 00000000000..a1f501607b0 --- /dev/null +++ b/packages/plugintest/src/plugin-cutonfold.js @@ -0,0 +1,27 @@ +const draftCutonfold = part => { + + const { points, Point, paths, Path, options, macro } = part.shorthand() + + if (options.plugin === 'cutonfold') { + + points.a = new Point(0,0) + points.b = new Point(200,0) + macro('cutonfold', { + from: points.a, + to: points.b, + margin: options.cutonfoldMargin, + offset: options.cutonfoldOffset, + grainline: options.cutonfoldGrainline + }) + + // Prevent clipping of text + paths.box = new Path() + .move(new Point(0,-30)) + .line(new Point(210, 10)) + .attr('class', 'hidden') + } + + return part +} + +export default draftCutonfold