feat(plugintest): Added plugin-logo
This commit is contained in:
parent
582807f8b7
commit
684a71a8d8
4 changed files with 50 additions and 8 deletions
|
@ -25,6 +25,7 @@ export default {
|
||||||
'bartackStart',
|
'bartackStart',
|
||||||
'bartackEnd',
|
'bartackEnd',
|
||||||
],
|
],
|
||||||
|
buttons: [ 'buttonsScale', 'buttonsRotate' ],
|
||||||
cutonfold: [
|
cutonfold: [
|
||||||
'cutonfoldMargin',
|
'cutonfoldMargin',
|
||||||
'cutonfoldOffset',
|
'cutonfoldOffset',
|
||||||
|
@ -38,6 +39,7 @@ export default {
|
||||||
],
|
],
|
||||||
flip: [ 'flipAxis' ],
|
flip: [ 'flipAxis' ],
|
||||||
gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ],
|
gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ],
|
||||||
|
logo: [ 'logoScale', 'logoRotate' ],
|
||||||
},
|
},
|
||||||
measurements: [],
|
measurements: [],
|
||||||
parts: [
|
parts: [
|
||||||
|
@ -50,7 +52,7 @@ export default {
|
||||||
'gore',
|
'gore',
|
||||||
'grainline',
|
'grainline',
|
||||||
'i18n',
|
'i18n',
|
||||||
//'logo',
|
'logo',
|
||||||
//'measurements',
|
//'measurements',
|
||||||
//'mirror',
|
//'mirror',
|
||||||
//'notches',
|
//'notches',
|
||||||
|
@ -65,7 +67,7 @@ export default {
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
plugin: {
|
plugin: {
|
||||||
dflt: 'i18n',
|
dflt: 'logo',
|
||||||
list: [
|
list: [
|
||||||
'all',
|
'all',
|
||||||
'banner',
|
'banner',
|
||||||
|
@ -102,6 +104,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 },
|
||||||
|
// Buttons options
|
||||||
|
buttonsScale: { pct: 100, min: 10, max: 200 },
|
||||||
|
buttonsRotate: { deg: 0, min: -360, max: 360 },
|
||||||
// Cutonfold options
|
// Cutonfold options
|
||||||
cutonfoldMargin: { count: 5, min: 0, max: 25 },
|
cutonfoldMargin: { count: 5, min: 0, max: 25 },
|
||||||
cutonfoldOffset: { count: 15, min: 0, max: 100 },
|
cutonfoldOffset: { count: 15, min: 0, max: 100 },
|
||||||
|
@ -117,6 +122,9 @@ export default {
|
||||||
goreRadius: { count: 20, min: 10, max: 30 },
|
goreRadius: { count: 20, min: 10, max: 30 },
|
||||||
goreGoreNumber: { count: 6, min: 4, max: 8 },
|
goreGoreNumber: { count: 6, min: 4, max: 8 },
|
||||||
goreExtraLength: { count: 10, min: 0, max: 20 },
|
goreExtraLength: { count: 10, min: 0, max: 20 },
|
||||||
|
// Logo options
|
||||||
|
logoScale: { pct: 100, min: 10, max: 200 },
|
||||||
|
logoRotate: { deg: 0, min: -360, max: 360 },
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@ 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'
|
||||||
import grainline from '@freesewing/plugin-grainline'
|
import grainline from '@freesewing/plugin-grainline'
|
||||||
import i18n from '@freesewing/plugin-i18n'
|
// Not importing i18n since it's a run-time plugin loaded by workbench
|
||||||
//import logo from '@freesewing/plugin-logo'
|
//import i18n from '@freesewing/plugin-i18n'
|
||||||
|
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'
|
||||||
|
@ -32,7 +33,7 @@ import draftFlip from './plugin-flip'
|
||||||
import draftGore from './plugin-gore'
|
import draftGore from './plugin-gore'
|
||||||
import draftGrainline from './plugin-grainline'
|
import draftGrainline from './plugin-grainline'
|
||||||
import draftI18n from './plugin-i18n'
|
import draftI18n from './plugin-i18n'
|
||||||
//import draftLogo from './plugin-logo'
|
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'
|
||||||
|
@ -58,8 +59,9 @@ const plugins = [
|
||||||
flip,
|
flip,
|
||||||
gore,
|
gore,
|
||||||
grainline,
|
grainline,
|
||||||
// Not loading i18n because it's already loaded by Workbench
|
// Not using i18n since it's a run-time plugin loaded by workbench
|
||||||
// logo,
|
// i18n,
|
||||||
|
logo,
|
||||||
// measurements,
|
// measurements,
|
||||||
// mirror,
|
// mirror,
|
||||||
// notches,
|
// notches,
|
||||||
|
@ -83,7 +85,7 @@ const methods = {
|
||||||
draftGore,
|
draftGore,
|
||||||
draftGrainline,
|
draftGrainline,
|
||||||
draftI18n,
|
draftI18n,
|
||||||
// draftLogo,
|
draftLogo,
|
||||||
// draftMeasurements,
|
// draftMeasurements,
|
||||||
// draftMirror,
|
// draftMirror,
|
||||||
// draftNotches,
|
// draftNotches,
|
||||||
|
|
|
@ -17,6 +17,8 @@ const draftButtons = part => {
|
||||||
for (const add of addThese) {
|
for (const add of addThese) {
|
||||||
points[add] = new Point(x, 0)
|
points[add] = new Point(x, 0)
|
||||||
snippets[add] = new Snippet(add, points[add])
|
snippets[add] = new Snippet(add, points[add])
|
||||||
|
.attr('data-scale', options.buttonsScale)
|
||||||
|
.attr('data-rotate', options.buttonsRotate)
|
||||||
x += 20
|
x += 20
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
packages/plugintest/src/plugin-logo.js
Normal file
30
packages/plugintest/src/plugin-logo.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
const addThese = [
|
||||||
|
'button',
|
||||||
|
'buttonhole',
|
||||||
|
'buttonhole-start',
|
||||||
|
'buttonhole-end',
|
||||||
|
'snap-stud',
|
||||||
|
'snap-socket'
|
||||||
|
]
|
||||||
|
|
||||||
|
const draftButtons = part => {
|
||||||
|
|
||||||
|
const { points, Point, paths, Path, snippets, Snippet, options } = part.shorthand()
|
||||||
|
|
||||||
|
if (['logo', 'all'].indexOf(options.plugin) !== -1) {
|
||||||
|
points.a = new Point(40, 40)
|
||||||
|
snippets.a = new Snippet('logo', points.a)
|
||||||
|
.attr('data-scale', options.logoScale)
|
||||||
|
.attr('data-rotate', options.logoRotate)
|
||||||
|
|
||||||
|
// Prevent clipping of text
|
||||||
|
paths.box = new Path()
|
||||||
|
.move(new Point(0,0))
|
||||||
|
.line(new Point(80, 60))
|
||||||
|
.attr('class', 'hidden')
|
||||||
|
}
|
||||||
|
|
||||||
|
return part
|
||||||
|
}
|
||||||
|
|
||||||
|
export default draftButtons
|
Loading…
Add table
Add a link
Reference in a new issue