chore(hortensia): Utilize expand for all reactangles and camelCase stuff
This commit is contained in:
parent
4c7326cb9a
commit
8d74e42d49
9 changed files with 152 additions and 68 deletions
|
@ -4,23 +4,29 @@
|
||||||
"p": {
|
"p": {
|
||||||
"top": "Top",
|
"top": "Top",
|
||||||
"bottom": "Bottom",
|
"bottom": "Bottom",
|
||||||
"bottompanel": "Bottom panel",
|
"bottomPanel": "Bottom panel",
|
||||||
"frontpanel": "Front panel",
|
"frontPanel": "Front panel",
|
||||||
"sidepanel": "Side panel",
|
"sidePanel": "Side panel",
|
||||||
"sidepanelreinforcement": "Side panel reinforcement",
|
"sidePanelReinforcement": "Side panel reinforcement",
|
||||||
"strap": "Strap",
|
"strap": "Strap",
|
||||||
"zipperpanel": "Zipper panel"
|
"zipperPanel": "Zipper panel"
|
||||||
},
|
},
|
||||||
"s": {
|
"s": {
|
||||||
"SidePanel": "Side Panel",
|
"cutBottomPanel.t": "The bottom panel is not shown",
|
||||||
"FrontBackPanel": "Front and Back Panel",
|
"cutBottomPanel.d": "The **Bottom panel** is a rectangular of {{{ width }}} wide and {{{ length }}} long (this includes seam allowance). You need to cut 1 from the main fabric, and 1 from the lining fabric. \n\nThis part is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.",
|
||||||
"BottomPanel": "Bottom Panel",
|
"cutFrontPanel.t": "The front panel is not shown",
|
||||||
"ZipperPanel": "Zipper Panel",
|
"cutFrontPanel.d": "The **Front panel** is a rectangular of {{{ width }}} wide and {{{ length }}} long (this includes seam allowance). You need to cut 2 from the main fabric, and 2 from the lining fabric. \n\nThis part is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.",
|
||||||
"Strap": "Handle",
|
"cutStrap.t": "The strap is not shown",
|
||||||
|
"cutStrap.d": "The **Strap** is a rectangular of {{{ width }}} wide and {{{ length }}} long (this includes seam allowance). You need to cut 2 from the main fabric. \n\nThis part is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.",
|
||||||
|
"cutStrapReducedSa.t": "The strap is not shown (and has reduced seam allowance)",
|
||||||
|
"cutStrapReducedSa.d": "The **Strap** is a rectangular of {{{ width }}} wide and {{{ length }}} long (this includes a reduced seam allowance of 80% of the strap width). You need to cut 2 from the main fabric. \n\nThis part is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.",
|
||||||
|
"cutZipperPanel.t": "The zipper panel is not shown",
|
||||||
|
"cutZipperPanel.d": "The **Zipper panel** is a rectangular of {{{ width }}} wide and {{{ length }}} long (this includes seam allowance). You need to cut 1 from the main fabric. \n\nThis part is not shown because the **expand** core setting is currently disabled. Enable it to show this pattern part.",
|
||||||
"strapLength": "Length of the handles",
|
"strapLength": "Length of the handles",
|
||||||
|
"strapSaReduced.t": "The strap seam allowance is reduced",
|
||||||
|
"strapSaReduced.d": "Because of how narrow the strap is, we have reduced the seam allowance on it to be 80% of the strap width",
|
||||||
"handleWidth": "Width of the handles",
|
"handleWidth": "Width of the handles",
|
||||||
"zipperSize": "Standard zipper size",
|
"zipperSize": "Standard zipper size"
|
||||||
"SidePanelReinforcement": "Side Reinforcement Panel"
|
|
||||||
},
|
},
|
||||||
"o": {
|
"o": {
|
||||||
"size": {
|
"size": {
|
||||||
|
|
|
@ -1,12 +1,50 @@
|
||||||
import { sidepanel } from './sidepanel.mjs'
|
import { sidePanel } from './sidepanel.mjs'
|
||||||
|
|
||||||
export const bottompanel = {
|
export const bottomPanel = {
|
||||||
name: 'hortensia.bottompanel',
|
name: 'hortensia.bottomPanel',
|
||||||
after: sidepanel,
|
after: sidePanel,
|
||||||
draft: ({ store, options, Point, Path, points, paths, Snippet, snippets, sa, macro, part }) => {
|
draft: ({
|
||||||
|
store,
|
||||||
|
expand,
|
||||||
|
units,
|
||||||
|
options,
|
||||||
|
Point,
|
||||||
|
Path,
|
||||||
|
points,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
sa,
|
||||||
|
macro,
|
||||||
|
part,
|
||||||
|
}) => {
|
||||||
const w = store.get('bottomPanelLength')
|
const w = store.get('bottomPanelLength')
|
||||||
const h = store.get('depth')
|
const h = store.get('depth')
|
||||||
|
|
||||||
|
if (expand) {
|
||||||
|
store.flag.preset('expandIsOn')
|
||||||
|
} else {
|
||||||
|
// Expand is off, do not draw the part but flag this to the user
|
||||||
|
store.flag.note({
|
||||||
|
msg: `hortensia:cutBottomPanel`,
|
||||||
|
replace: {
|
||||||
|
width: units(w + 2 * sa),
|
||||||
|
length: units(h + 2 * sa),
|
||||||
|
},
|
||||||
|
suggest: {
|
||||||
|
text: 'flag:show',
|
||||||
|
icon: 'expand',
|
||||||
|
update: {
|
||||||
|
settings: ['expand', 1],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// Also hint about expand
|
||||||
|
store.flag.preset('expandIsOff')
|
||||||
|
|
||||||
|
return part.hide()
|
||||||
|
}
|
||||||
|
|
||||||
points.topLeft = new Point(0, 0)
|
points.topLeft = new Point(0, 0)
|
||||||
points.topRight = new Point(w, 0)
|
points.topRight = new Point(w, 0)
|
||||||
points.bottomLeft = new Point(0, h)
|
points.bottomLeft = new Point(0, h)
|
||||||
|
@ -33,7 +71,7 @@ export const bottompanel = {
|
||||||
macro('title', {
|
macro('title', {
|
||||||
at: points.title,
|
at: points.title,
|
||||||
nr: 3,
|
nr: 3,
|
||||||
title: 'BottomPanel',
|
title: 'bottomPanel',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export function bottomsidepanel(points, topMiddle, w, h, sizeRatio) {
|
export function bottomSidePanel(points, topMiddle, w, h, sizeRatio) {
|
||||||
const c = 0.551915024494 // circle constant
|
const c = 0.551915024494 // circle constant
|
||||||
const cornerCP = 20 * sizeRatio
|
const cornerCP = 20 * sizeRatio
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { sidepanel } from './sidepanel.mjs'
|
import { sidePanel } from './sidepanel.mjs'
|
||||||
|
|
||||||
export const frontpanel = {
|
export const frontPanel = {
|
||||||
name: 'hortensia.frontpanel',
|
name: 'hortensia.frontPanel',
|
||||||
after: sidepanel,
|
after: sidePanel,
|
||||||
options: {
|
options: {
|
||||||
minHandleSpaceWidth: 80,
|
minHandleSpaceWidth: 80,
|
||||||
maxHandleSpaceWidth: 250,
|
maxHandleSpaceWidth: 250,
|
||||||
|
@ -21,12 +21,38 @@ export const frontpanel = {
|
||||||
Snippet,
|
Snippet,
|
||||||
snippets,
|
snippets,
|
||||||
sa,
|
sa,
|
||||||
|
expand,
|
||||||
|
units,
|
||||||
macro,
|
macro,
|
||||||
part,
|
part,
|
||||||
}) => {
|
}) => {
|
||||||
const w = store.get('frontPanelLength')
|
const w = store.get('frontPanelLength')
|
||||||
const h = store.get('depth')
|
const h = store.get('depth')
|
||||||
|
|
||||||
|
if (expand) {
|
||||||
|
store.flag.preset('expandIsOn')
|
||||||
|
} else {
|
||||||
|
// Expand is off, do not draw the part but flag this to the user
|
||||||
|
store.flag.note({
|
||||||
|
msg: `hortensia:cutFrontPanel`,
|
||||||
|
replace: {
|
||||||
|
width: units(w + 2 * sa),
|
||||||
|
length: units(h + 2 * sa),
|
||||||
|
},
|
||||||
|
suggest: {
|
||||||
|
text: 'flag:show',
|
||||||
|
icon: 'expand',
|
||||||
|
update: {
|
||||||
|
settings: ['expand', 1],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// Also hint about expand
|
||||||
|
store.flag.preset('expandIsOff')
|
||||||
|
|
||||||
|
return part.hide()
|
||||||
|
}
|
||||||
|
|
||||||
points.topLeft = new Point(0, 0)
|
points.topLeft = new Point(0, 0)
|
||||||
points.topRight = new Point(w, 0)
|
points.topRight = new Point(w, 0)
|
||||||
points.bottomLeft = new Point(0, h)
|
points.bottomLeft = new Point(0, h)
|
||||||
|
@ -86,8 +112,10 @@ export const frontpanel = {
|
||||||
id: 'att2',
|
id: 'att2',
|
||||||
})
|
})
|
||||||
|
|
||||||
store.cutlist.addCut({ cut: 2, from: 'fabric' })
|
store.cutlist.setCut([
|
||||||
store.cutlist.addCut({ cut: 2, material: 'lining' })
|
{ cut: 2, from: 'fabric' },
|
||||||
|
{ cut: 2, from: 'lining' },
|
||||||
|
])
|
||||||
|
|
||||||
points.logo = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)
|
points.logo = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)
|
||||||
snippets.logo = new Snippet('logo', points.logo)
|
snippets.logo = new Snippet('logo', points.logo)
|
||||||
|
@ -98,7 +126,7 @@ export const frontpanel = {
|
||||||
macro('title', {
|
macro('title', {
|
||||||
at: points.title,
|
at: points.title,
|
||||||
nr: 2,
|
nr: 2,
|
||||||
title: 'FrontPanel',
|
title: 'frontPanel',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -2,26 +2,26 @@ import { Design } from '@freesewing/core'
|
||||||
import { data } from '../data.mjs'
|
import { data } from '../data.mjs'
|
||||||
import { i18n } from '../i18n/index.mjs'
|
import { i18n } from '../i18n/index.mjs'
|
||||||
// Parts
|
// Parts
|
||||||
import { sidepanel } from './sidepanel.mjs'
|
import { sidePanel } from './sidepanel.mjs'
|
||||||
import { frontpanel } from './frontpanel.mjs'
|
import { frontPanel } from './frontpanel.mjs'
|
||||||
import { bottompanel } from './bottompanel.mjs'
|
import { bottomPanel } from './bottompanel.mjs'
|
||||||
import { zipperpanel } from './zipperpanel.mjs'
|
import { zipperPanel } from './zipperpanel.mjs'
|
||||||
import { sidepanelreinforcement } from './sidepanelreinforcement.mjs'
|
import { sidePanelReinforcement } from './sidepanelreinforcement.mjs'
|
||||||
import { strap } from './strap.mjs'
|
import { strap } from './strap.mjs'
|
||||||
|
|
||||||
// Create new design
|
// Create new design
|
||||||
const Hortensia = new Design({
|
const Hortensia = new Design({
|
||||||
data,
|
data,
|
||||||
parts: [sidepanel, frontpanel, bottompanel, zipperpanel, sidepanelreinforcement, strap],
|
parts: [sidePanel, frontPanel, bottomPanel, zipperPanel, sidePanelReinforcement, strap],
|
||||||
})
|
})
|
||||||
|
|
||||||
// Named exports
|
// Named exports
|
||||||
export {
|
export {
|
||||||
sidepanel,
|
sidePanel,
|
||||||
frontpanel,
|
frontPanel,
|
||||||
bottompanel,
|
bottomPanel,
|
||||||
zipperpanel,
|
zipperPanel,
|
||||||
sidepanelreinforcement,
|
sidePanelReinforcement,
|
||||||
strap,
|
strap,
|
||||||
Hortensia,
|
Hortensia,
|
||||||
i18n,
|
i18n,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { bottomsidepanel } from './bottomsidepanel.mjs'
|
import { bottomSidePanel } from './bottomsidepanel.mjs'
|
||||||
|
|
||||||
// Default width and height:
|
// Default width and height:
|
||||||
const width = 230
|
const width = 230
|
||||||
const height = 330
|
const height = 330
|
||||||
|
|
||||||
export const sidepanel = {
|
export const sidePanel = {
|
||||||
name: 'hortensia.sidepanel',
|
name: 'hortensia.sidePanel',
|
||||||
options: {
|
options: {
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -80,7 +80,7 @@ export const sidepanel = {
|
||||||
points.topMiddleCPL = points.topMiddle.shift(180, topCP)
|
points.topMiddleCPL = points.topMiddle.shift(180, topCP)
|
||||||
points.topMiddleCPR = points.topMiddle.shift(0, topCP * 1.1)
|
points.topMiddleCPR = points.topMiddle.shift(0, topCP * 1.1)
|
||||||
|
|
||||||
bottomsidepanel(points, points.topMiddle, w, h, sizeRatio)
|
bottomSidePanel(points, points.topMiddle, w, h, sizeRatio)
|
||||||
|
|
||||||
points.shoulderLeft = points.bottomLeft.shift(90, sideLength)
|
points.shoulderLeft = points.bottomLeft.shift(90, sideLength)
|
||||||
points.shoulderLeftCP = points.shoulderLeft.shift(90, shoulderCP)
|
points.shoulderLeftCP = points.shoulderLeft.shift(90, shoulderCP)
|
||||||
|
@ -155,7 +155,7 @@ export const sidepanel = {
|
||||||
macro('title', {
|
macro('title', {
|
||||||
at: points.title,
|
at: points.title,
|
||||||
nr: 1,
|
nr: 1,
|
||||||
title: 'sidepanel',
|
title: 'sidePanel',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { sidepanel } from './sidepanel.mjs'
|
import { sidePanel } from './sidepanel.mjs'
|
||||||
import { bottomsidepanel } from './bottomsidepanel.mjs'
|
import { bottomSidePanel } from './bottomsidepanel.mjs'
|
||||||
|
|
||||||
export const sidepanelreinforcement = {
|
export const sidePanelReinforcement = {
|
||||||
name: 'hortensia.sidepanelreinforcement',
|
name: 'hortensia.sidePanelReinforcement',
|
||||||
after: sidepanel,
|
after: sidePanel,
|
||||||
draft: ({ store, Point, Path, points, paths, sa, macro, part }) => {
|
draft: ({ store, Point, Path, points, paths, sa, macro, part }) => {
|
||||||
const w = store.get('width')
|
const w = store.get('width')
|
||||||
const h = store.get('sidePanelReinforcementHeight')
|
const h = store.get('sidePanelReinforcementHeight')
|
||||||
|
@ -13,7 +13,7 @@ export const sidepanelreinforcement = {
|
||||||
points.topLeft = points.topMiddle.shift(180, w / 2)
|
points.topLeft = points.topMiddle.shift(180, w / 2)
|
||||||
points.topRight = points.topMiddle.shift(0, w / 2)
|
points.topRight = points.topMiddle.shift(0, w / 2)
|
||||||
|
|
||||||
bottomsidepanel(points, points.topMiddle, w, h, sizeRatio)
|
bottomSidePanel(points, points.topMiddle, w, h, sizeRatio)
|
||||||
|
|
||||||
paths.seam = new Path()
|
paths.seam = new Path()
|
||||||
.move(points.topMiddle)
|
.move(points.topMiddle)
|
||||||
|
@ -35,7 +35,7 @@ export const sidepanelreinforcement = {
|
||||||
macro('title', {
|
macro('title', {
|
||||||
at: points.title,
|
at: points.title,
|
||||||
nr: 4,
|
nr: 4,
|
||||||
title: 'sidepanelreinforcement',
|
title: 'sidePanelReinforcement',
|
||||||
scale: 0.25,
|
scale: 0.25,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { sidepanel } from './sidepanel.mjs'
|
import { sidePanel } from './sidepanel.mjs'
|
||||||
|
|
||||||
export const strap = {
|
export const strap = {
|
||||||
name: 'hortensia.strap',
|
name: 'hortensia.strap',
|
||||||
after: sidepanel,
|
after: sidePanel,
|
||||||
options: {
|
options: {
|
||||||
strapLength: { pct: 160, min: 75, max: 250, menu: 'style' },
|
strapLength: { pct: 160, min: 75, max: 250, menu: 'style' },
|
||||||
handleWidth: { pct: 8.6, min: 4, max: 25, menu: 'style' },
|
handleWidth: { pct: 8.6, min: 4, max: 25, menu: 'style' },
|
||||||
|
@ -11,13 +11,28 @@ export const strap = {
|
||||||
const w = store.get('width') * options.handleWidth
|
const w = store.get('width') * options.handleWidth
|
||||||
const h = store.get('depth') * options.strapLength
|
const h = store.get('depth') * options.strapLength
|
||||||
|
|
||||||
if (!expand) {
|
let reducedSa = false
|
||||||
|
if (sa > w * 0.8) {
|
||||||
|
sa = w * 0.8
|
||||||
|
reducedSa = true
|
||||||
|
|
||||||
|
store.flag.warn({
|
||||||
|
msg: `hortensia:strapSaReduced`,
|
||||||
|
replace: {
|
||||||
|
width: units(w + 2 * sa),
|
||||||
|
length: units(h + 2 * sa),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (expand) store.flag.preset('expandIsOn')
|
||||||
|
else {
|
||||||
// Expand is on, do not draw the part but flag this to the user
|
// Expand is on, do not draw the part but flag this to the user
|
||||||
store.flag.note({
|
store.flag.note({
|
||||||
msg: `hortensia:strap`,
|
msg: reducedSa ? `hortensia:cutStrapReducedSa` : `hortensia:cutStrap`,
|
||||||
replace: {
|
replace: {
|
||||||
width: units(w),
|
width: units(w + 2 * sa),
|
||||||
length: units(h),
|
length: units(h + 2 * sa),
|
||||||
},
|
},
|
||||||
suggest: {
|
suggest: {
|
||||||
text: 'flag:show',
|
text: 'flag:show',
|
||||||
|
@ -28,15 +43,11 @@ export const strap = {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Also hint about expand
|
// Also hint about expand
|
||||||
store.flag.preset('expand')
|
store.flag.preset('expandIsOff')
|
||||||
|
|
||||||
return part.hide()
|
return part.hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa > w * 0.8) {
|
|
||||||
sa = w * 0.8
|
|
||||||
}
|
|
||||||
|
|
||||||
points.topLeft = new Point(-w, 0)
|
points.topLeft = new Point(-w, 0)
|
||||||
points.topMiddle = new Point(0, 0)
|
points.topMiddle = new Point(0, 0)
|
||||||
points.topRight = new Point(w, 0)
|
points.topRight = new Point(w, 0)
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
import { sidepanel } from './sidepanel.mjs'
|
import { sidePanel } from './sidepanel.mjs'
|
||||||
|
|
||||||
export const zipperpanel = {
|
export const zipperPanel = {
|
||||||
name: 'hortensia.zipperpanel',
|
name: 'hortensia.zipperPanel',
|
||||||
after: sidepanel,
|
after: sidePanel,
|
||||||
draft: ({ store, Point, Path, points, paths, sa, macro, expand, units, part }) => {
|
draft: ({ store, Point, Path, points, paths, sa, macro, expand, units, part }) => {
|
||||||
const z = store.get('zipperWidth')
|
const z = store.get('zipperWidth')
|
||||||
const w = (store.get('zipperPanelWidth') - z) / 2
|
const w = (store.get('zipperPanelWidth') - z) / 2
|
||||||
const h = store.get('depth')
|
const h = store.get('depth')
|
||||||
|
|
||||||
if (!expand) {
|
if (expand) store.flag.preset('expandIsOn')
|
||||||
// Expand is on, do not draw the part but flag this to the user
|
else {
|
||||||
|
// Expand is off, do not draw the part but flag this to the user
|
||||||
store.flag.note({
|
store.flag.note({
|
||||||
msg: `hortensia:zipperpanel`,
|
msg: `hortensia:cutZipperPanel`,
|
||||||
replace: {
|
replace: {
|
||||||
width: units(w),
|
width: units(w),
|
||||||
length: units(h),
|
length: units(h),
|
||||||
|
@ -25,7 +26,7 @@ export const zipperpanel = {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
// Also hint about expand
|
// Also hint about expand
|
||||||
store.flag.preset('expand')
|
store.flag.preset('expandIsOff')
|
||||||
|
|
||||||
return part.hide()
|
return part.hide()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue