1
0
Fork 0

chore(florent): Port to v3 stage 2

This commit is contained in:
joostdecock 2022-09-11 14:28:25 +02:00
parent 9206ee4e4c
commit a217074fd7
6 changed files with 60 additions and 31 deletions

View file

@ -1,9 +1,19 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
function draftFlorentBrimBottom (part) { function draftFlorentBrimBottom({
let { paperless, sa, store, complete, points, options, macro, Point, paths, Path, measurements } = paperless,
part.shorthand() sa,
store,
complete,
points,
options,
macro,
Point,
paths,
Path,
measurements,
part,
}) {
let scale = 1 let scale = 1
let base = scale * measurements.head * (1 + options.headEase) let base = scale * measurements.head * (1 + options.headEase)
@ -85,14 +95,14 @@ function draftFlorentBrimBottom (part) {
export const brimBottom = { export const brimBottom = {
name: 'florent.brimBottom', name: 'florent.brimBottom',
measurements: [ 'head' ], measurements: ['head'],
options : { options: {
// Constants // Constants
topSide: 0.8, topSide: 0.8,
brim: 0, brim: 0,
// Percentages // Percentages
headEase: { pct: 2, min: 0, max: 5, menu: 'fit' }, headEase: { pct: 2, min: 0, max: 5, menu: 'fit' },
}, },
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftFlorentBrimBottom, draft: draftFlorentBrimBottom,
} }

View file

@ -1,8 +1,15 @@
import { brimBottom } from './brimbottom.mjs' import { brimBottom } from './brimbottom.mjs'
function draftFlorentBrimInterfacing (part) { function draftFlorentBrimInterfacing({
let { paperless, sa, complete, points, macro, paths, Path } = part.shorthand() paperless,
sa,
complete,
points,
macro,
paths,
Path,
part,
}) {
paths.hint = paths.seam.clone().attr('class', 'dashed stroke-sm') paths.hint = paths.seam.clone().attr('class', 'dashed stroke-sm')
paths.outset = new Path() paths.outset = new Path()

View file

@ -1,8 +1,6 @@
import { brimBottom } from './brimbottom.mjs' import { brimBottom } from './brimbottom.mjs'
function draftFlorentBrimTop (part) { function draftFlorentBrimTop({ paperless, sa, complete, points, macro, paths, Path, part }) {
let { paperless, sa, complete, points, macro, paths, Path } = part.shorthand()
paths.hint = new Path() paths.hint = new Path()
.move(points.tipLeft) .move(points.tipLeft)
.curve(points.tipLeftCp2, points.outerMidCp1, points.outerMid) .curve(points.tipLeftCp2, points.outerMidCp1, points.outerMid)

View file

@ -10,13 +10,8 @@ import { brimInterfacing } from './briminterfacing.mjs'
// Create new design // Create new design
const Florent = new Design({ const Florent = new Design({
data, data,
parts: [ parts: [top, side, brimBottom, brimTop, brimInterfacing],
top, side, brimBottom, brimTop, brimInterfacing,
]
}) })
// Named exports // Named exports
export { export { top, side, brimBottom, brimTop, brimInterfacing, Florent }
top, side, brimBottom, brimTop, brimInterfacing,
Florent,
}

View file

@ -1,9 +1,18 @@
import { top } from './top.mjs' import { top } from './top.mjs'
function draftFlorentSide (part) { function draftFlorentSide({
let { store, paperless, sa, complete, points, macro, paths, Path, snippets, Snippet } = store,
part.shorthand() paperless,
sa,
complete,
points,
macro,
paths,
Path,
snippets,
Snippet,
part,
}) {
// Clean up // Clean up
for (let i of Object.keys(paths)) { for (let i of Object.keys(paths)) {
if (i !== 'side') delete paths[i] if (i !== 'side') delete paths[i]

View file

@ -1,9 +1,19 @@
import { pluginBundle } from '@freesewing/plugin-bundle' import { pluginBundle } from '@freesewing/plugin-bundle'
function draftFlorentTop (part) { function draftFlorentTop({
let { paperless, sa, points, macro, Point, Path, paths, snippets, Snippet, complete, store } = paperless,
part.shorthand() sa,
points,
macro,
Point,
Path,
paths,
snippets,
Snippet,
complete,
store,
part,
}) {
const fitCap = (part, scale) => { const fitCap = (part, scale) => {
let { points, options, Point, Path, measurements } = part.shorthand() let { points, options, Point, Path, measurements } = part.shorthand()
@ -214,14 +224,14 @@ function draftFlorentTop (part) {
export const top = { export const top = {
name: 'florent.top', name: 'florent.top',
measurements: [ 'head' ], measurements: ['head'],
options : { options: {
// Constants // Constants
topSide: 0.8, topSide: 0.8,
brim: 0, brim: 0,
// Percentages // Percentages
headEase: { pct: 2, min: 0, max: 5, menu: 'fit' }, headEase: { pct: 2, min: 0, max: 5, menu: 'fit' },
}, },
plugins: [ pluginBundle ], plugins: [pluginBundle],
draft: draftFlorentTop, draft: draftFlorentTop,
} }