feat(plugintest): Added cutonfold. See #1648
This commit is contained in:
parent
5d43ce2860
commit
7e1961c5ba
3 changed files with 43 additions and 7 deletions
|
@ -24,14 +24,19 @@ export default {
|
|||
'bartackWidth',
|
||||
'bartackStart',
|
||||
'bartackEnd',
|
||||
]
|
||||
],
|
||||
cutonfold: [
|
||||
'cutonfoldMargin',
|
||||
'cutonfoldOffset',
|
||||
'cutonfoldGrainline',
|
||||
],
|
||||
},
|
||||
measurements: [],
|
||||
parts: [
|
||||
'banner',
|
||||
'bartack',
|
||||
'buttons',
|
||||
//'cutonfold',
|
||||
'cutonfold',
|
||||
//'dimension',
|
||||
//'flip',
|
||||
//'gore',
|
||||
|
@ -52,7 +57,7 @@ export default {
|
|||
],
|
||||
options: {
|
||||
plugin: {
|
||||
dflt: 'buttons',
|
||||
dflt: 'cutonfold',
|
||||
list: [
|
||||
'banner',
|
||||
'bartack',
|
||||
|
@ -88,5 +93,9 @@ export default {
|
|||
bartackWidth: {count: 3, min: 1, max: 5 },
|
||||
bartackStart: {pct: 25, min: 0, max: 100 },
|
||||
bartackEnd: {pct: 75, min: 0, max: 100 },
|
||||
// Cutonfold options
|
||||
cutonfoldMargin: { count: 5, min: 0, max: 25 },
|
||||
cutonfoldOffset: { count: 15, min: 0, max: 100 },
|
||||
cutonfoldGrainline: { bool: false },
|
||||
},
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import config from '../config'
|
|||
import banner from '@freesewing/plugin-banner'
|
||||
import bartack from '@freesewing/plugin-bartack'
|
||||
import buttons from '@freesewing/plugin-buttons'
|
||||
//import cutonfold from '@freesewing/plugin-cutonfold'
|
||||
import cutonfold from '@freesewing/plugin-cutonfold'
|
||||
//import dimension from '@freesewing/plugin-dimension'
|
||||
//import flip from '@freesewing/plugin-flip'
|
||||
//import gore from '@freesewing/plugin-gore'
|
||||
|
@ -26,7 +26,7 @@ import buttons from '@freesewing/plugin-buttons'
|
|||
import draftBanner from './plugin-banner'
|
||||
import draftBartack from './plugin-bartack'
|
||||
import draftButtons from './plugin-buttons'
|
||||
//import draftCutonfold from './plugin-cutonfold'
|
||||
import draftCutonfold from './plugin-cutonfold'
|
||||
//import draftDimension from './plugin-dimension'
|
||||
//import draftFlip from './plugin-flip'
|
||||
//import draftGore from './plugin-gore'
|
||||
|
@ -53,7 +53,7 @@ const plugins = [
|
|||
banner,
|
||||
bartack,
|
||||
buttons,
|
||||
// cutonfold,
|
||||
cutonfold,
|
||||
// dimension,
|
||||
// flip,
|
||||
// gore,
|
||||
|
@ -77,7 +77,7 @@ const methods = {
|
|||
draftBanner,
|
||||
draftBartack,
|
||||
draftButtons,
|
||||
// draftCutonfold,
|
||||
draftCutonfold,
|
||||
// draftDimension,
|
||||
// draftFlip,
|
||||
// draftGore,
|
||||
|
|
27
packages/plugintest/src/plugin-cutonfold.js
Normal file
27
packages/plugintest/src/plugin-cutonfold.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const draftCutonfold = part => {
|
||||
|
||||
const { points, Point, paths, Path, options, macro } = part.shorthand()
|
||||
|
||||
if (options.plugin === 'cutonfold') {
|
||||
|
||||
points.a = new Point(0,0)
|
||||
points.b = new Point(200,0)
|
||||
macro('cutonfold', {
|
||||
from: points.a,
|
||||
to: points.b,
|
||||
margin: options.cutonfoldMargin,
|
||||
offset: options.cutonfoldOffset,
|
||||
grainline: options.cutonfoldGrainline
|
||||
})
|
||||
|
||||
// Prevent clipping of text
|
||||
paths.box = new Path()
|
||||
.move(new Point(0,-30))
|
||||
.line(new Point(210, 10))
|
||||
.attr('class', 'hidden')
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
export default draftCutonfold
|
Loading…
Add table
Add a link
Reference in a new issue