feat(plugintest): Added plugin-title
This commit is contained in:
parent
647059b058
commit
7a73c8823f
3 changed files with 48 additions and 21 deletions
|
@ -44,6 +44,13 @@ export default {
|
||||||
round: [ 'roundRadius', 'roundRender' ],
|
round: [ 'roundRadius', 'roundRender' ],
|
||||||
scalebox: [ 'scaleboxType' ],
|
scalebox: [ 'scaleboxType' ],
|
||||||
sprinkle: [ 'sprinkleScale', 'sprinkleRotate', 'sprinkleSnippet' ],
|
sprinkle: [ 'sprinkleScale', 'sprinkleRotate', 'sprinkleSnippet' ],
|
||||||
|
title: [
|
||||||
|
'titleNr',
|
||||||
|
'titleTitle',
|
||||||
|
'titleMeta',
|
||||||
|
'titleScale',
|
||||||
|
'titleRotate'
|
||||||
|
],
|
||||||
},
|
},
|
||||||
measurements: [],
|
measurements: [],
|
||||||
parts: [
|
parts: [
|
||||||
|
@ -63,15 +70,13 @@ export default {
|
||||||
'round',
|
'round',
|
||||||
'scalebox',
|
'scalebox',
|
||||||
'sprinkle',
|
'sprinkle',
|
||||||
//'svgattr',
|
'title',
|
||||||
//'theme',
|
|
||||||
//'title',
|
|
||||||
//'validate',
|
//'validate',
|
||||||
//'versionfreeSvg',
|
//'versionfreeSvg',
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
plugin: {
|
plugin: {
|
||||||
dflt: 'sprinkle',
|
dflt: 'title',
|
||||||
list: [
|
list: [
|
||||||
'all',
|
'all',
|
||||||
'banner',
|
'banner',
|
||||||
|
@ -90,7 +95,6 @@ export default {
|
||||||
'round',
|
'round',
|
||||||
'scalebox',
|
'scalebox',
|
||||||
'sprinkle',
|
'sprinkle',
|
||||||
'svgattr',
|
|
||||||
'theme',
|
'theme',
|
||||||
'title',
|
'title',
|
||||||
'validate',
|
'validate',
|
||||||
|
@ -140,7 +144,7 @@ export default {
|
||||||
sprinkleScale: { pct: 100, min: 10, max: 200 },
|
sprinkleScale: { pct: 100, min: 10, max: 200 },
|
||||||
sprinkleRotate: { deg: 0, min: -360, max: 360 },
|
sprinkleRotate: { deg: 0, min: -360, max: 360 },
|
||||||
sprinkleSnippet: {
|
sprinkleSnippet: {
|
||||||
dflt: 'notch',
|
dflt: 'title',
|
||||||
list: [
|
list: [
|
||||||
'notch',
|
'notch',
|
||||||
'bnotch',
|
'bnotch',
|
||||||
|
@ -153,5 +157,11 @@ export default {
|
||||||
'logo',
|
'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 },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@ import notches from '@freesewing/plugin-notches'
|
||||||
import round from '@freesewing/plugin-round'
|
import round from '@freesewing/plugin-round'
|
||||||
import scalebox from '@freesewing/plugin-scalebox'
|
import scalebox from '@freesewing/plugin-scalebox'
|
||||||
import sprinkle from '@freesewing/plugin-sprinkle'
|
import sprinkle from '@freesewing/plugin-sprinkle'
|
||||||
//import svgattr from '@freesewing/plugin-svgattr'
|
import title from '@freesewing/plugin-title'
|
||||||
//import theme from '@freesewing/plugin-theme'
|
|
||||||
//import title from '@freesewing/plugin-title'
|
|
||||||
//import validate from '@freesewing/plugin-validate'
|
//import validate from '@freesewing/plugin-validate'
|
||||||
//import versionfreeSvg from '@freesewing/plugin-versionfree-svg'
|
//import versionfreeSvg from '@freesewing/plugin-versionfree-svg'
|
||||||
// Parts
|
// Parts
|
||||||
|
@ -40,14 +38,9 @@ import draftNotches from './plugin-notches'
|
||||||
import draftRound from './plugin-round'
|
import draftRound from './plugin-round'
|
||||||
import draftScalebox from './plugin-scalebox'
|
import draftScalebox from './plugin-scalebox'
|
||||||
import draftSprinkle from './plugin-sprinkle'
|
import draftSprinkle from './plugin-sprinkle'
|
||||||
//import draftSvgattr from './plugin-svgattr'
|
import draftTitle from './plugin-title'
|
||||||
//import draftTheme from './plugin-theme'
|
|
||||||
//import draftTitle from './plugin-title'
|
|
||||||
//import draftValidate from './plugin-validate'
|
//import draftValidate from './plugin-validate'
|
||||||
//import draftVersionfreeSvg from './plugin-versionfree-svg'
|
//import draftVersionfreeSvg from './plugin-versionfree-svg'
|
||||||
// Note included:
|
|
||||||
// plugin-bundle: Is just a wrapper
|
|
||||||
// plugin-export-dxf: Deprecated
|
|
||||||
|
|
||||||
|
|
||||||
const plugins = [
|
const plugins = [
|
||||||
|
@ -68,9 +61,7 @@ const plugins = [
|
||||||
round,
|
round,
|
||||||
scalebox,
|
scalebox,
|
||||||
sprinkle,
|
sprinkle,
|
||||||
// svgattr,
|
title,
|
||||||
// theme,
|
|
||||||
// title,
|
|
||||||
// validate,
|
// validate,
|
||||||
// versionfreeSvg,
|
// versionfreeSvg,
|
||||||
]
|
]
|
||||||
|
@ -92,9 +83,7 @@ const methods = {
|
||||||
draftRound,
|
draftRound,
|
||||||
draftScalebox,
|
draftScalebox,
|
||||||
draftSprinkle,
|
draftSprinkle,
|
||||||
// draftSvgattr,
|
draftTitle,
|
||||||
// draftTheme,
|
|
||||||
// draftTitle,
|
|
||||||
// draftValidate,
|
// draftValidate,
|
||||||
// draftVersionfreeSvg,
|
// draftVersionfreeSvg,
|
||||||
}
|
}
|
||||||
|
|
28
packages/plugintest/src/plugin-title.js
Normal file
28
packages/plugintest/src/plugin-title.js
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue