feat(plugintest): Added plugin-mirror
This commit is contained in:
parent
303176f513
commit
8d83eedd6b
3 changed files with 81 additions and 6 deletions
|
@ -40,6 +40,7 @@ export default {
|
|||
flip: [ 'flipAxis' ],
|
||||
gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ],
|
||||
logo: [ 'logoScale', 'logoRotate' ],
|
||||
mirror: [ 'mirrorLine', 'mirrorClone' ],
|
||||
},
|
||||
measurements: [],
|
||||
parts: [
|
||||
|
@ -54,7 +55,7 @@ export default {
|
|||
'i18n',
|
||||
'logo',
|
||||
'measurements',
|
||||
//'mirror',
|
||||
'mirror',
|
||||
//'notches',
|
||||
//'round',
|
||||
//'scalebox',
|
||||
|
@ -67,7 +68,7 @@ export default {
|
|||
],
|
||||
options: {
|
||||
plugin: {
|
||||
dflt: 'measurements',
|
||||
dflt: 'mirror',
|
||||
list: [
|
||||
'all',
|
||||
'banner',
|
||||
|
@ -125,6 +126,9 @@ export default {
|
|||
// Logo options
|
||||
logoScale: { pct: 100, min: 10, max: 200 },
|
||||
logoRotate: { deg: 0, min: -360, max: 360 },
|
||||
// Mirror options
|
||||
mirrorLine: { dflt: 'a', list: ['a', 'b', 'none' ] },
|
||||
mirrorClone: { bool: true },
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import grainline from '@freesewing/plugin-grainline'
|
|||
//import i18n from '@freesewing/plugin-i18n'
|
||||
import logo from '@freesewing/plugin-logo'
|
||||
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 round from '@freesewing/plugin-round'
|
||||
//import scalebox from '@freesewing/plugin-scalebox'
|
||||
|
@ -35,7 +35,7 @@ import draftGrainline from './plugin-grainline'
|
|||
import draftI18n from './plugin-i18n'
|
||||
import draftLogo from './plugin-logo'
|
||||
import draftMeasurements from './plugin-measurements'
|
||||
//import draftMirror from './plugin-mirror'
|
||||
import draftMirror from './plugin-mirror'
|
||||
//import draftNotches from './plugin-notches'
|
||||
//import draftRound from './plugin-round'
|
||||
//import draftScalebox from './plugin-scalebox'
|
||||
|
@ -63,7 +63,7 @@ const plugins = [
|
|||
// i18n,
|
||||
logo,
|
||||
measurements,
|
||||
// mirror,
|
||||
mirror,
|
||||
// notches,
|
||||
// round,
|
||||
// scalebox,
|
||||
|
@ -87,7 +87,7 @@ const methods = {
|
|||
draftI18n,
|
||||
draftLogo,
|
||||
draftMeasurements,
|
||||
// draftMirror,
|
||||
draftMirror,
|
||||
// draftNotches,
|
||||
// draftRound,
|
||||
// draftScalebox,
|
||||
|
|
71
packages/plugintest/src/plugin-mirror.js
Normal file
71
packages/plugintest/src/plugin-mirror.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
const draftDimension = part => {
|
||||
|
||||
const { points, Point, paths, Path, snippets, Snippet, options, macro } = part.shorthand()
|
||||
|
||||
if (['mirror', 'all'].indexOf(options.plugin) !== -1) {
|
||||
|
||||
points.mirrorA = new Point(0,0)
|
||||
points.mirrorB = new Point(70,30)
|
||||
points.mirrorC = new Point(0,50)
|
||||
points.mirrorD = new Point(30,-30)
|
||||
paths.mirrorA = new Path()
|
||||
.move(points.mirrorA)
|
||||
.line(points.mirrorB)
|
||||
.attr("class", "dashed note")
|
||||
.attr('data-text', 'Mirror A')
|
||||
.attr('data-text-class', 'right')
|
||||
paths.mirrorB = new Path()
|
||||
.move(points.mirrorC)
|
||||
.line(points.mirrorD)
|
||||
.attr("class", "dashed note")
|
||||
.attr('data-text', 'Mirror B')
|
||||
.attr('data-text-class', 'right')
|
||||
|
||||
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)
|
||||
|
||||
|
||||
if (options.mirrorLine !== 'none') {
|
||||
macro('mirror', {
|
||||
mirror: options.mirrorLine === 'a'
|
||||
? [points.mirrorA, points.mirrorB]
|
||||
: [points.mirrorC, points.mirrorD],
|
||||
points: [
|
||||
points.b1,
|
||||
points.h2,
|
||||
points.h3,
|
||||
points.v2,
|
||||
points.v3,
|
||||
points.a,
|
||||
points.b,
|
||||
points.c,
|
||||
points.d,
|
||||
points.e,
|
||||
],
|
||||
paths: [paths.a, paths.b],
|
||||
clone: options.mirrorClone,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return part
|
||||
}
|
||||
|
||||
export default draftDimension
|
Loading…
Add table
Add a link
Reference in a new issue