diff --git a/packages/plugintest/config/index.js b/packages/plugintest/config/index.js index c1fde126529..a5c00de86cd 100644 --- a/packages/plugintest/config/index.js +++ b/packages/plugintest/config/index.js @@ -25,6 +25,7 @@ export default { 'bartackStart', 'bartackEnd', ], + buttons: [ 'buttonsScale', 'buttonsRotate' ], cutonfold: [ 'cutonfoldMargin', 'cutonfoldOffset', @@ -38,6 +39,7 @@ export default { ], flip: [ 'flipAxis' ], gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ], + logo: [ 'logoScale', 'logoRotate' ], }, measurements: [], parts: [ @@ -50,7 +52,7 @@ export default { 'gore', 'grainline', 'i18n', - //'logo', + 'logo', //'measurements', //'mirror', //'notches', @@ -65,7 +67,7 @@ export default { ], options: { plugin: { - dflt: 'i18n', + dflt: 'logo', list: [ 'all', 'banner', @@ -102,6 +104,9 @@ export default { bartackWidth: {count: 3, min: 1, max: 5 }, bartackStart: {pct: 25, min: 0, max: 100 }, bartackEnd: {pct: 75, min: 0, max: 100 }, + // Buttons options + buttonsScale: { pct: 100, min: 10, max: 200 }, + buttonsRotate: { deg: 0, min: -360, max: 360 }, // Cutonfold options cutonfoldMargin: { count: 5, min: 0, max: 25 }, cutonfoldOffset: { count: 15, min: 0, max: 100 }, @@ -117,6 +122,9 @@ export default { goreRadius: { count: 20, min: 10, max: 30 }, goreGoreNumber: { count: 6, min: 4, max: 8 }, goreExtraLength: { count: 10, min: 0, max: 20 }, + // Logo options + logoScale: { pct: 100, min: 10, max: 200 }, + logoRotate: { deg: 0, min: -360, max: 360 }, } } diff --git a/packages/plugintest/src/index.js b/packages/plugintest/src/index.js index c2762796450..026f88203ef 100644 --- a/packages/plugintest/src/index.js +++ b/packages/plugintest/src/index.js @@ -9,8 +9,9 @@ import dimension from '@freesewing/plugin-dimension' import flip from '@freesewing/plugin-flip' import gore from '@freesewing/plugin-gore' import grainline from '@freesewing/plugin-grainline' -import i18n from '@freesewing/plugin-i18n' -//import logo from '@freesewing/plugin-logo' +// Not importing i18n since it's a run-time plugin loaded by workbench +//import i18n from '@freesewing/plugin-i18n' +import logo from '@freesewing/plugin-logo' //import measurements from '@freesewing/plugin-measurements' //import mirror from '@freesewing/plugin-mirror' //import notches from '@freesewing/plugin-notches' @@ -32,7 +33,7 @@ import draftFlip from './plugin-flip' import draftGore from './plugin-gore' import draftGrainline from './plugin-grainline' import draftI18n from './plugin-i18n' -//import draftLogo from './plugin-logo' +import draftLogo from './plugin-logo' //import draftMeasurements from './plugin-measurements' //import draftMirror from './plugin-mirror' //import draftNotches from './plugin-notches' @@ -58,8 +59,9 @@ const plugins = [ flip, gore, grainline, - // Not loading i18n because it's already loaded by Workbench -// logo, + // Not using i18n since it's a run-time plugin loaded by workbench + // i18n, + logo, // measurements, // mirror, // notches, @@ -83,7 +85,7 @@ const methods = { draftGore, draftGrainline, draftI18n, -// draftLogo, + draftLogo, // draftMeasurements, // draftMirror, // draftNotches, diff --git a/packages/plugintest/src/plugin-buttons.js b/packages/plugintest/src/plugin-buttons.js index 101930624dd..d1e9162e549 100644 --- a/packages/plugintest/src/plugin-buttons.js +++ b/packages/plugintest/src/plugin-buttons.js @@ -17,6 +17,8 @@ const draftButtons = part => { 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 } diff --git a/packages/plugintest/src/plugin-logo.js b/packages/plugintest/src/plugin-logo.js new file mode 100644 index 00000000000..8b8a28e67fe --- /dev/null +++ b/packages/plugintest/src/plugin-logo.js @@ -0,0 +1,30 @@ +const addThese = [ + 'button', + 'buttonhole', + 'buttonhole-start', + 'buttonhole-end', + 'snap-stud', + 'snap-socket' +] + +const draftButtons = part => { + + const { points, Point, paths, Path, snippets, Snippet, options } = part.shorthand() + + if (['logo', 'all'].indexOf(options.plugin) !== -1) { + points.a = new Point(40, 40) + snippets.a = new Snippet('logo', points.a) + .attr('data-scale', options.logoScale) + .attr('data-rotate', options.logoRotate) + + // Prevent clipping of text + paths.box = new Path() + .move(new Point(0,0)) + .line(new Point(80, 60)) + .attr('class', 'hidden') + } + + return part +} + +export default draftButtons