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',
|
'bartackWidth',
|
||||||
'bartackStart',
|
'bartackStart',
|
||||||
'bartackEnd',
|
'bartackEnd',
|
||||||
]
|
],
|
||||||
|
cutonfold: [
|
||||||
|
'cutonfoldMargin',
|
||||||
|
'cutonfoldOffset',
|
||||||
|
'cutonfoldGrainline',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
measurements: [],
|
measurements: [],
|
||||||
parts: [
|
parts: [
|
||||||
'banner',
|
'banner',
|
||||||
'bartack',
|
'bartack',
|
||||||
'buttons',
|
'buttons',
|
||||||
//'cutonfold',
|
'cutonfold',
|
||||||
//'dimension',
|
//'dimension',
|
||||||
//'flip',
|
//'flip',
|
||||||
//'gore',
|
//'gore',
|
||||||
|
@ -52,7 +57,7 @@ export default {
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
plugin: {
|
plugin: {
|
||||||
dflt: 'buttons',
|
dflt: 'cutonfold',
|
||||||
list: [
|
list: [
|
||||||
'banner',
|
'banner',
|
||||||
'bartack',
|
'bartack',
|
||||||
|
@ -88,5 +93,9 @@ export default {
|
||||||
bartackWidth: {count: 3, min: 1, max: 5 },
|
bartackWidth: {count: 3, min: 1, max: 5 },
|
||||||
bartackStart: {pct: 25, min: 0, max: 100 },
|
bartackStart: {pct: 25, min: 0, max: 100 },
|
||||||
bartackEnd: {pct: 75, 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 banner from '@freesewing/plugin-banner'
|
||||||
import bartack from '@freesewing/plugin-bartack'
|
import bartack from '@freesewing/plugin-bartack'
|
||||||
import buttons from '@freesewing/plugin-buttons'
|
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 dimension from '@freesewing/plugin-dimension'
|
||||||
//import flip from '@freesewing/plugin-flip'
|
//import flip from '@freesewing/plugin-flip'
|
||||||
//import gore from '@freesewing/plugin-gore'
|
//import gore from '@freesewing/plugin-gore'
|
||||||
|
@ -26,7 +26,7 @@ import buttons from '@freesewing/plugin-buttons'
|
||||||
import draftBanner from './plugin-banner'
|
import draftBanner from './plugin-banner'
|
||||||
import draftBartack from './plugin-bartack'
|
import draftBartack from './plugin-bartack'
|
||||||
import draftButtons from './plugin-buttons'
|
import draftButtons from './plugin-buttons'
|
||||||
//import draftCutonfold from './plugin-cutonfold'
|
import draftCutonfold from './plugin-cutonfold'
|
||||||
//import draftDimension from './plugin-dimension'
|
//import draftDimension from './plugin-dimension'
|
||||||
//import draftFlip from './plugin-flip'
|
//import draftFlip from './plugin-flip'
|
||||||
//import draftGore from './plugin-gore'
|
//import draftGore from './plugin-gore'
|
||||||
|
@ -53,7 +53,7 @@ const plugins = [
|
||||||
banner,
|
banner,
|
||||||
bartack,
|
bartack,
|
||||||
buttons,
|
buttons,
|
||||||
// cutonfold,
|
cutonfold,
|
||||||
// dimension,
|
// dimension,
|
||||||
// flip,
|
// flip,
|
||||||
// gore,
|
// gore,
|
||||||
|
@ -77,7 +77,7 @@ const methods = {
|
||||||
draftBanner,
|
draftBanner,
|
||||||
draftBartack,
|
draftBartack,
|
||||||
draftButtons,
|
draftButtons,
|
||||||
// draftCutonfold,
|
draftCutonfold,
|
||||||
// draftDimension,
|
// draftDimension,
|
||||||
// draftFlip,
|
// draftFlip,
|
||||||
// draftGore,
|
// 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