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' ],
|
||||
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 },
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
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