1
0
Fork 0

feat(plugintest): Added plugin-logo

This commit is contained in:
Joost De Cock 2022-01-18 12:16:09 +01:00
parent 582807f8b7
commit 684a71a8d8
4 changed files with 50 additions and 8 deletions

View file

@ -25,6 +25,7 @@ export default {
'bartackStart',
'bartackEnd',
],
buttons: [ 'buttonsScale', 'buttonsRotate' ],
cutonfold: [
'cutonfoldMargin',
'cutonfoldOffset',
@ -38,6 +39,7 @@ export default {
],
flip: [ 'flipAxis' ],
gore: [ 'goreRadius', 'goreGoreNumber', 'goreExtraLength' ],
logo: [ 'logoScale', 'logoRotate' ],
},
measurements: [],
parts: [
@ -50,7 +52,7 @@ export default {
'gore',
'grainline',
'i18n',
//'logo',
'logo',
//'measurements',
//'mirror',
//'notches',
@ -65,7 +67,7 @@ export default {
],
options: {
plugin: {
dflt: 'i18n',
dflt: 'logo',
list: [
'all',
'banner',
@ -102,6 +104,9 @@ export default {
bartackWidth: {count: 3, min: 1, max: 5 },
bartackStart: {pct: 25, 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
cutonfoldMargin: { count: 5, min: 0, max: 25 },
cutonfoldOffset: { count: 15, min: 0, max: 100 },
@ -117,6 +122,9 @@ export default {
goreRadius: { count: 20, min: 10, max: 30 },
goreGoreNumber: { count: 6, min: 4, max: 8 },
goreExtraLength: { count: 10, min: 0, max: 20 },
// Logo options
logoScale: { pct: 100, min: 10, max: 200 },
logoRotate: { deg: 0, min: -360, max: 360 },
}
}

View file

@ -9,8 +9,9 @@ import dimension from '@freesewing/plugin-dimension'
import flip from '@freesewing/plugin-flip'
import gore from '@freesewing/plugin-gore'
import grainline from '@freesewing/plugin-grainline'
import i18n from '@freesewing/plugin-i18n'
//import logo from '@freesewing/plugin-logo'
// Not importing i18n since it's a run-time plugin loaded by workbench
//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 notches from '@freesewing/plugin-notches'
@ -32,7 +33,7 @@ import draftFlip from './plugin-flip'
import draftGore from './plugin-gore'
import draftGrainline from './plugin-grainline'
import draftI18n from './plugin-i18n'
//import draftLogo from './plugin-logo'
import draftLogo from './plugin-logo'
//import draftMeasurements from './plugin-measurements'
//import draftMirror from './plugin-mirror'
//import draftNotches from './plugin-notches'
@ -58,8 +59,9 @@ const plugins = [
flip,
gore,
grainline,
// Not loading i18n because it's already loaded by Workbench
// logo,
// Not using i18n since it's a run-time plugin loaded by workbench
// i18n,
logo,
// measurements,
// mirror,
// notches,
@ -83,7 +85,7 @@ const methods = {
draftGore,
draftGrainline,
draftI18n,
// draftLogo,
draftLogo,
// draftMeasurements,
// draftMirror,
// draftNotches,

View file

@ -17,6 +17,8 @@ const draftButtons = part => {
for (const add of addThese) {
points[add] = new Point(x, 0)
snippets[add] = new Snippet(add, points[add])
.attr('data-scale', options.buttonsScale)
.attr('data-rotate', options.buttonsRotate)
x += 20
}

View 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