feat(plugintest): Added plugin-notches
This commit is contained in:
parent
5a2ae9a20a
commit
bdea7fe9b2
3 changed files with 37 additions and 6 deletions
|
@ -56,7 +56,7 @@ export default {
|
||||||
'logo',
|
'logo',
|
||||||
'measurements',
|
'measurements',
|
||||||
'mirror',
|
'mirror',
|
||||||
//'notches',
|
'notches',
|
||||||
//'round',
|
//'round',
|
||||||
//'scalebox',
|
//'scalebox',
|
||||||
//'sprinkle',
|
//'sprinkle',
|
||||||
|
@ -68,7 +68,7 @@ export default {
|
||||||
],
|
],
|
||||||
options: {
|
options: {
|
||||||
plugin: {
|
plugin: {
|
||||||
dflt: 'mirror',
|
dflt: 'notches',
|
||||||
list: [
|
list: [
|
||||||
'all',
|
'all',
|
||||||
'banner',
|
'banner',
|
||||||
|
|
|
@ -14,7 +14,7 @@ import grainline from '@freesewing/plugin-grainline'
|
||||||
import logo from '@freesewing/plugin-logo'
|
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'
|
||||||
//import round from '@freesewing/plugin-round'
|
//import round from '@freesewing/plugin-round'
|
||||||
//import scalebox from '@freesewing/plugin-scalebox'
|
//import scalebox from '@freesewing/plugin-scalebox'
|
||||||
//import sprinkle from '@freesewing/plugin-sprinkle'
|
//import sprinkle from '@freesewing/plugin-sprinkle'
|
||||||
|
@ -36,7 +36,7 @@ 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'
|
||||||
//import draftRound from './plugin-round'
|
//import draftRound from './plugin-round'
|
||||||
//import draftScalebox from './plugin-scalebox'
|
//import draftScalebox from './plugin-scalebox'
|
||||||
//import draftSprinkle from './plugin-sprinkle'
|
//import draftSprinkle from './plugin-sprinkle'
|
||||||
|
@ -64,7 +64,7 @@ const plugins = [
|
||||||
logo,
|
logo,
|
||||||
measurements,
|
measurements,
|
||||||
mirror,
|
mirror,
|
||||||
// notches,
|
notches,
|
||||||
// round,
|
// round,
|
||||||
// scalebox,
|
// scalebox,
|
||||||
// sprinkle,
|
// sprinkle,
|
||||||
|
@ -88,7 +88,7 @@ const methods = {
|
||||||
draftLogo,
|
draftLogo,
|
||||||
draftMeasurements,
|
draftMeasurements,
|
||||||
draftMirror,
|
draftMirror,
|
||||||
// draftNotches,
|
draftNotches,
|
||||||
// draftRound,
|
// draftRound,
|
||||||
// draftScalebox,
|
// draftScalebox,
|
||||||
// draftSprinkle,
|
// draftSprinkle,
|
||||||
|
|
31
packages/plugintest/src/plugin-notches.js
Normal file
31
packages/plugintest/src/plugin-notches.js
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue