feat(plugintest): Added plugin-flip
This commit is contained in:
parent
12433ae11e
commit
4d358dfc52
3 changed files with 52 additions and 7 deletions
|
@ -36,6 +36,7 @@ export default {
|
|||
'dimensionEndMarker',
|
||||
'dimensionStartMarker',
|
||||
],
|
||||
flip: [ 'flipAxis' ],
|
||||
},
|
||||
measurements: [],
|
||||
parts: [
|
||||
|
@ -44,7 +45,7 @@ export default {
|
|||
'buttons',
|
||||
'cutonfold',
|
||||
'dimension',
|
||||
//'flip',
|
||||
'flip',
|
||||
//'gore',
|
||||
//'grainline',
|
||||
//'i18n',
|
||||
|
@ -63,7 +64,7 @@ export default {
|
|||
],
|
||||
options: {
|
||||
plugin: {
|
||||
dflt: 'dimension',
|
||||
dflt: 'flip',
|
||||
list: [
|
||||
'all',
|
||||
'banner',
|
||||
|
@ -109,5 +110,7 @@ export default {
|
|||
dimensionD: { count: 10, min: -20, max: 20 },
|
||||
dimensionEndMarker: { bool: true },
|
||||
dimensionStartMarker: { bool: true },
|
||||
},
|
||||
// Flip options
|
||||
flipAxis: { dflt: 'x', list: ['x', 'y'] },
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import bartack from '@freesewing/plugin-bartack'
|
|||
import buttons from '@freesewing/plugin-buttons'
|
||||
import cutonfold from '@freesewing/plugin-cutonfold'
|
||||
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 grainline from '@freesewing/plugin-grainline'
|
||||
//import i18n from '@freesewing/plugin-i18n'
|
||||
|
@ -28,7 +28,7 @@ import draftBartack from './plugin-bartack'
|
|||
import draftButtons from './plugin-buttons'
|
||||
import draftCutonfold from './plugin-cutonfold'
|
||||
import draftDimension from './plugin-dimension'
|
||||
//import draftFlip from './plugin-flip'
|
||||
import draftFlip from './plugin-flip'
|
||||
//import draftGore from './plugin-gore'
|
||||
//import draftGrainline from './plugin-grainline'
|
||||
//import draftI18n from './plugin-i18n'
|
||||
|
@ -55,7 +55,7 @@ const plugins = [
|
|||
buttons,
|
||||
cutonfold,
|
||||
dimension,
|
||||
// flip,
|
||||
flip,
|
||||
// gore,
|
||||
// grainline,
|
||||
// i18n,
|
||||
|
@ -79,7 +79,7 @@ const methods = {
|
|||
draftButtons,
|
||||
draftCutonfold,
|
||||
draftDimension,
|
||||
// draftFlip,
|
||||
draftFlip,
|
||||
// draftGore,
|
||||
// draftGrainline,
|
||||
// draftI18n,
|
||||
|
|
42
packages/plugintest/src/plugin-flip.js
Normal file
42
packages/plugintest/src/plugin-flip.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
const draftDimension = part => {
|
||||
|
||||
const { points, Point, paths, Path, snippets, Snippet, options, macro } = part.shorthand()
|
||||
|
||||
if (['flip', 'all'].indexOf(options.plugin) !== -1) {
|
||||
|
||||
points.mirrorA = new Point(50,0)
|
||||
points.mirrorB = new Point(0,0)
|
||||
points.mirrorC = new Point(0,50)
|
||||
paths.mirror = new Path()
|
||||
.move(points.mirrorA)
|
||||
.line(points.mirrorB)
|
||||
.line(points.mirrorC)
|
||||
.attr("class", "dashed note")
|
||||
|
||||
points.b1 = new Point(10,10).attr('data-text', 1)
|
||||
points.h2 = new Point(20,10).attr('data-text', 2)
|
||||
points.h3 = new Point(30,10).attr('data-text', 3)
|
||||
points.v2 = new Point(10,20).attr('data-text', 2)
|
||||
points.v3 = new Point(10,30).attr('data-text', 3)
|
||||
points.a = new Point(10,0)
|
||||
points.b = new Point(30,30)
|
||||
points.c = new Point(50,50)
|
||||
points.d = new Point(12,34)
|
||||
points.e = new Point(54,34)
|
||||
|
||||
snippets.a = new Snippet('button', points.b)
|
||||
|
||||
paths.a = new Path()
|
||||
.move(points.a)
|
||||
.line(points.b)
|
||||
paths.b = new Path()
|
||||
.move(points.e)
|
||||
.curve(points.a, points.d, points.c)
|
||||
|
||||
macro('flip', { axis: options.flipAxis })
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
export default draftDimension
|
Loading…
Add table
Add a link
Reference in a new issue