diff --git a/packages/plugintest/config/index.js b/packages/plugintest/config/index.js index 5ed20fe7e23..c38ec1253e9 100644 --- a/packages/plugintest/config/index.js +++ b/packages/plugintest/config/index.js @@ -44,6 +44,13 @@ export default { round: [ 'roundRadius', 'roundRender' ], scalebox: [ 'scaleboxType' ], sprinkle: [ 'sprinkleScale', 'sprinkleRotate', 'sprinkleSnippet' ], + title: [ + 'titleNr', + 'titleTitle', + 'titleMeta', + 'titleScale', + 'titleRotate' + ], }, measurements: [], parts: [ @@ -63,15 +70,13 @@ export default { 'round', 'scalebox', 'sprinkle', - //'svgattr', - //'theme', - //'title', + 'title', //'validate', //'versionfreeSvg', ], options: { plugin: { - dflt: 'sprinkle', + dflt: 'title', list: [ 'all', 'banner', @@ -90,7 +95,6 @@ export default { 'round', 'scalebox', 'sprinkle', - 'svgattr', 'theme', 'title', 'validate', @@ -140,7 +144,7 @@ export default { sprinkleScale: { pct: 100, min: 10, max: 200 }, sprinkleRotate: { deg: 0, min: -360, max: 360 }, sprinkleSnippet: { - dflt: 'notch', + dflt: 'title', list: [ 'notch', 'bnotch', @@ -153,5 +157,11 @@ export default { 'logo', ] }, + // Title options + titleNr: { count: 1, min: 0, max: 100 }, + titleTitle: { bool: true }, + titleMeta: { bool: true }, + titleScale: { pct: 100, min: 10, max: 200 }, + titleRotate: { deg: 0, min: -360, max: 360 }, } } diff --git a/packages/plugintest/src/index.js b/packages/plugintest/src/index.js index 447daf4d1f2..25e609c90c7 100644 --- a/packages/plugintest/src/index.js +++ b/packages/plugintest/src/index.js @@ -18,9 +18,7 @@ import notches from '@freesewing/plugin-notches' import round from '@freesewing/plugin-round' import scalebox from '@freesewing/plugin-scalebox' import sprinkle from '@freesewing/plugin-sprinkle' -//import svgattr from '@freesewing/plugin-svgattr' -//import theme from '@freesewing/plugin-theme' -//import title from '@freesewing/plugin-title' +import title from '@freesewing/plugin-title' //import validate from '@freesewing/plugin-validate' //import versionfreeSvg from '@freesewing/plugin-versionfree-svg' // Parts @@ -40,14 +38,9 @@ import draftNotches from './plugin-notches' import draftRound from './plugin-round' import draftScalebox from './plugin-scalebox' import draftSprinkle from './plugin-sprinkle' -//import draftSvgattr from './plugin-svgattr' -//import draftTheme from './plugin-theme' -//import draftTitle from './plugin-title' +import draftTitle from './plugin-title' //import draftValidate from './plugin-validate' //import draftVersionfreeSvg from './plugin-versionfree-svg' -// Note included: -// plugin-bundle: Is just a wrapper -// plugin-export-dxf: Deprecated const plugins = [ @@ -68,9 +61,7 @@ const plugins = [ round, scalebox, sprinkle, -// svgattr, -// theme, -// title, + title, // validate, // versionfreeSvg, ] @@ -92,9 +83,7 @@ const methods = { draftRound, draftScalebox, draftSprinkle, -// draftSvgattr, -// draftTheme, -// draftTitle, + draftTitle, // draftValidate, // draftVersionfreeSvg, } diff --git a/packages/plugintest/src/plugin-title.js b/packages/plugintest/src/plugin-title.js new file mode 100644 index 00000000000..872b2db5333 --- /dev/null +++ b/packages/plugintest/src/plugin-title.js @@ -0,0 +1,28 @@ +const draftTitle = part => { + + const { points, Point, paths, Path, macro, options } = part.shorthand() + + if (['title', 'all'].indexOf(options.plugin) !== -1) { + + if (options.titleMeta) part.context.settings.metadata = { for: 'Some user' } + points.a = new Point(20,0) + macro('title', { + at: points.a, + nr: options.titleNr, + title: options.titleTitle ? 'Title here' : false, + prefix: 'prefix', + rotation: options.titleRotate, + scale: options.titleScale, + + }) + // Prevent clipping of text + paths.box = new Path() + .move(new Point(0,-20)) + .line(new Point(120, 20)) + .attr('class', 'hidden') + } + + return part +} + +export default draftTitle