1
0
Fork 0

feat(plugintest): Added plugin-notches

This commit is contained in:
Joost De Cock 2022-01-18 14:27:01 +01:00
parent 5a2ae9a20a
commit bdea7fe9b2
3 changed files with 37 additions and 6 deletions

View file

@ -56,7 +56,7 @@ export default {
'logo',
'measurements',
'mirror',
//'notches',
'notches',
//'round',
//'scalebox',
//'sprinkle',
@ -68,7 +68,7 @@ export default {
],
options: {
plugin: {
dflt: 'mirror',
dflt: 'notches',
list: [
'all',
'banner',

View file

@ -14,7 +14,7 @@ import grainline from '@freesewing/plugin-grainline'
import logo from '@freesewing/plugin-logo'
import measurements from '@freesewing/plugin-measurements'
import mirror from '@freesewing/plugin-mirror'
//import notches from '@freesewing/plugin-notches'
import notches from '@freesewing/plugin-notches'
//import round from '@freesewing/plugin-round'
//import scalebox from '@freesewing/plugin-scalebox'
//import sprinkle from '@freesewing/plugin-sprinkle'
@ -36,7 +36,7 @@ import draftI18n from './plugin-i18n'
import draftLogo from './plugin-logo'
import draftMeasurements from './plugin-measurements'
import draftMirror from './plugin-mirror'
//import draftNotches from './plugin-notches'
import draftNotches from './plugin-notches'
//import draftRound from './plugin-round'
//import draftScalebox from './plugin-scalebox'
//import draftSprinkle from './plugin-sprinkle'
@ -64,7 +64,7 @@ const plugins = [
logo,
measurements,
mirror,
// notches,
notches,
// round,
// scalebox,
// sprinkle,
@ -88,7 +88,7 @@ const methods = {
draftLogo,
draftMeasurements,
draftMirror,
// draftNotches,
draftNotches,
// draftRound,
// draftScalebox,
// draftSprinkle,

View file

@ -0,0 +1,31 @@
const addThese = [
'notch',
'bnotch',
]
const draftNotches = part => {
const { points, Point, paths, Path, snippets, Snippet, options } = part.shorthand()
if (['notches', 'all'].indexOf(options.plugin) !== -1) {
let x = 10
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
}
// Prevent clipping of text
paths.box = new Path()
.move(new Point(0,-5))
.line(new Point(20*addThese.length, 5))
.attr('class', 'hidden')
}
return part
}
export default draftNotches