feat(plugintest): Added plugin-round
This commit is contained in:
parent
bdea7fe9b2
commit
ce70e40fba
3 changed files with 54 additions and 7 deletions
|
@ -41,6 +41,7 @@ export default {
|
||||||
gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ],
|
gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ],
|
||||||
logo: [ 'logoScale', 'logoRotate' ],
|
logo: [ 'logoScale', 'logoRotate' ],
|
||||||
mirror: [ 'mirrorLine', 'mirrorClone' ],
|
mirror: [ 'mirrorLine', 'mirrorClone' ],
|
||||||
|
round: [ 'roundRadius', 'roundRender' ],
|
||||||
},
|
},
|
||||||
measurements: [],
|
measurements: [],
|
||||||
parts: [
|
parts: [
|
||||||
|
@ -57,7 +58,7 @@ export default {
|
||||||
'measurements',
|
'measurements',
|
||||||
'mirror',
|
'mirror',
|
||||||
'notches',
|
'notches',
|
||||||
//'round',
|
'round',
|
||||||
//'scalebox',
|
//'scalebox',
|
||||||
//'sprinkle',
|
//'sprinkle',
|
||||||
//'svgattr',
|
//'svgattr',
|
||||||
|
@ -68,7 +69,7 @@ export default {
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
plugin: {
|
plugin: {
|
||||||
dflt: 'notches',
|
dflt: 'round',
|
||||||
list: [
|
list: [
|
||||||
'all',
|
'all',
|
||||||
'banner',
|
'banner',
|
||||||
|
@ -129,6 +130,8 @@ export default {
|
||||||
// Mirror options
|
// Mirror options
|
||||||
mirrorLine: { dflt: 'a', list: ['a', 'b', 'none' ] },
|
mirrorLine: { dflt: 'a', list: ['a', 'b', 'none' ] },
|
||||||
mirrorClone: { bool: true },
|
mirrorClone: { bool: true },
|
||||||
|
// Round options
|
||||||
|
roundRadius: { count: 10, min: 0, max: 50 },
|
||||||
|
roundRender: { bool: true },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import logo from '@freesewing/plugin-logo'
|
||||||
import measurements from '@freesewing/plugin-measurements'
|
import measurements from '@freesewing/plugin-measurements'
|
||||||
import mirror from '@freesewing/plugin-mirror'
|
import mirror from '@freesewing/plugin-mirror'
|
||||||
import notches from '@freesewing/plugin-notches'
|
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 svgattr from '@freesewing/plugin-svgattr'
|
||||||
|
@ -37,7 +37,7 @@ import draftLogo from './plugin-logo'
|
||||||
import draftMeasurements from './plugin-measurements'
|
import draftMeasurements from './plugin-measurements'
|
||||||
import draftMirror from './plugin-mirror'
|
import draftMirror from './plugin-mirror'
|
||||||
import draftNotches from './plugin-notches'
|
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 draftSvgattr from './plugin-svgattr'
|
||||||
|
@ -65,7 +65,7 @@ const plugins = [
|
||||||
measurements,
|
measurements,
|
||||||
mirror,
|
mirror,
|
||||||
notches,
|
notches,
|
||||||
// round,
|
round,
|
||||||
// scalebox,
|
// scalebox,
|
||||||
// sprinkle,
|
// sprinkle,
|
||||||
// svgattr,
|
// svgattr,
|
||||||
|
@ -89,7 +89,7 @@ const methods = {
|
||||||
draftMeasurements,
|
draftMeasurements,
|
||||||
draftMirror,
|
draftMirror,
|
||||||
draftNotches,
|
draftNotches,
|
||||||
// draftRound,
|
draftRound,
|
||||||
// draftScalebox,
|
// draftScalebox,
|
||||||
// draftSprinkle,
|
// draftSprinkle,
|
||||||
// draftSvgattr,
|
// draftSvgattr,
|
||||||
|
|
44
packages/plugintest/src/plugin-round.js
Normal file
44
packages/plugintest/src/plugin-round.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
const draftRound = part => {
|
||||||
|
|
||||||
|
const { Point, points, Path, paths, macro, options } = part.shorthand()
|
||||||
|
|
||||||
|
if (['round', 'all'].indexOf(options.plugin) !== -1) {
|
||||||
|
points.topLeft = new Point(0, 0)
|
||||||
|
points.bottomLeft = new Point(0, 30)
|
||||||
|
points.topRight = new Point(100, 0)
|
||||||
|
points.bottomRight = new Point(100, 30)
|
||||||
|
|
||||||
|
paths.demo = new Path()
|
||||||
|
.move(points.topLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.topRight)
|
||||||
|
.close()
|
||||||
|
.attr('class', 'note dashed')
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
radius: options.roundRadius,
|
||||||
|
render: options.roundRender
|
||||||
|
}
|
||||||
|
|
||||||
|
macro('round', {
|
||||||
|
from: points.topLeft,
|
||||||
|
to: points.bottomRight,
|
||||||
|
via: points.bottomLeft,
|
||||||
|
prefix: 'bl',
|
||||||
|
...opts
|
||||||
|
})
|
||||||
|
macro('round', {
|
||||||
|
from: points.bottomRight,
|
||||||
|
to: points.topLeft,
|
||||||
|
via: points.topRight,
|
||||||
|
prefix: 'tr',
|
||||||
|
...opts
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return part
|
||||||
|
}
|
||||||
|
|
||||||
|
export default draftRound
|
Loading…
Add table
Add a link
Reference in a new issue