1
0
Fork 0

chore: Linter

This commit is contained in:
Joost De Cock 2021-01-31 09:22:15 +01:00
parent adb9e93024
commit 1a46c8e724
227 changed files with 660 additions and 936 deletions

View file

@ -10,11 +10,11 @@ import draftFront from './front'
const Pattern = new freesewing.Design(config, plugins)
// Attach draft methods to prototype
Pattern.prototype.draftBase = function(part) {
Pattern.prototype.draftBase = function (part) {
// Getting the base part from Brian
return new Brian(this.settings).draftBase(part)
}
Pattern.prototype.draftFront = part => draftFront(part)
Pattern.prototype.draftBack = part => draftBack(part)
Pattern.prototype.draftFront = (part) => draftFront(part)
Pattern.prototype.draftBack = (part) => draftBack(part)
export default Pattern

View file

@ -11,7 +11,7 @@ export default function (part) {
paperless,
macro,
utils,
measurements,
measurements
} = part.shorthand()
// Get to work
@ -43,7 +43,10 @@ export default function (part) {
)
// Bust point
points.bust = new Point(measurements.bustSpan * 0.5 * (1 + options.bustSpanEase), measurements.hpsToBust)
points.bust = new Point(
measurements.bustSpan * 0.5 * (1 + options.bustSpanEase),
measurements.hpsToBust
)
// Construct armhole
points.armholeCp2 = points.armhole.shift(180, 40)
@ -112,15 +115,22 @@ export default function (part) {
)
points.bustDartBottom = points.bustDartTop.rotate(angle * -1, points.bust)
points.bustDartMiddle = points.bustDartTop.shiftFractionTowards(points.bustDartBottom, 0.5)
points.bustDartTip = points.bustDartMiddle.shiftFractionTowards(points.bust, options.bustDartLength)
points.bustDartTip = points.bustDartMiddle.shiftFractionTowards(
points.bust,
options.bustDartLength
)
points.bustDartEdge = utils.beamsIntersect(
points.bust,
points.bustDartMiddle,
points.armhole,
points.bustDartTop
)
points.bustDartCpTop = points.bust.shiftFractionTowards(points.bustDartTop, 0.666).rotate(5 * options.bustDartCurve, points.bust)
points.bustDartCpBottom = points.bust.shiftFractionTowards(points.bustDartBottom, 0.666).rotate(-5 * options.bustDartCurve, points.bust)
points.bustDartCpTop = points.bust
.shiftFractionTowards(points.bustDartTop, 0.666)
.rotate(5 * options.bustDartCurve, points.bust)
points.bustDartCpBottom = points.bust
.shiftFractionTowards(points.bustDartBottom, 0.666)
.rotate(-5 * options.bustDartCurve, points.bust)
// Side seam length
let aboveDart = points.armhole.dist(points.bustDartTop)
@ -142,10 +152,7 @@ export default function (part) {
points.bust,
options.waistDartLength
)
points.waistDartLeftCp = points.waistDartLeft.shift(
90,
points.waistDartHem.dist(points.bust) / 2
)
points.waistDartLeftCp = points.waistDartLeft.shift(90, points.waistDartHem.dist(points.bust) / 2)
points.waistDartRightCp = points.waistDartRight.shift(
90,
points.waistDartHem.dist(points.bust) / 2
@ -185,7 +192,7 @@ export default function (part) {
.setRender(false)
if (complete) {
points.titleAnchor = new Point(points.armholePitch.x/2, points.armholePitchCp2.y)
points.titleAnchor = new Point(points.armholePitch.x / 2, points.armholePitchCp2.y)
macro('title', {
at: points.titleAnchor,
nr: 1,
@ -205,122 +212,113 @@ export default function (part) {
})
macro('sprinkle', {
snippet: 'notch',
on: [
'bust',
'armholePitch',
'cfBust',
]
on: ['bust', 'armholePitch', 'cfBust']
})
if (sa) {
paths.sa = paths.saBase
.offset(sa)
.line(points.cfNeck)
.attr('class', 'fabric sa')
paths.sa = paths.sa
.move(points.cfHem)
.line(paths.sa.start())
paths.sa = paths.saBase.offset(sa).line(points.cfNeck).attr('class', 'fabric sa')
paths.sa = paths.sa.move(points.cfHem).line(paths.sa.start())
}
if (paperless) {
macro('vd', {
from: points.cfHem,
to: points.waistDartTip,
x: 0 - 15,
x: 0 - 15
})
macro('vd', {
from: points.cfHem,
to: points.bust,
x: 0 - 30,
x: 0 - 30
})
macro('vd', {
from: points.cfHem,
to: points.cfNeck,
x: 0 - 45,
x: 0 - 45
})
macro('vd', {
from: points.cfHem,
to: points.hps,
x: 0 - 60,
x: 0 - 60
})
macro('hd', {
from: points.cfBust,
to: points.bust,
y: points.bust.y - 15,
y: points.bust.y - 15
})
macro('hd', {
from: points.cfBust,
to: points.bustDartTip,
y: points.bust.y - 30,
y: points.bust.y - 30
})
macro('hd', {
from: points.cfHem,
to: points.waistDartLeft,
y: points.cfHem.y + sa + 15,
y: points.cfHem.y + sa + 15
})
macro('hd', {
from: points.cfHem,
to: points.waistDartRight,
y: points.cfHem.y + sa + 30,
y: points.cfHem.y + sa + 30
})
macro('hd', {
from: points.cfHem,
to: points.sideHem,
y: points.cfHem.y + sa + 45,
y: points.cfHem.y + sa + 45
})
macro('hd', {
from: points.cfHem,
to: points.bustDartBottom,
y: points.cfHem.y + sa + 60,
y: points.cfHem.y + sa + 60
})
macro('hd', {
from: points.cfHem,
to: points.bustDartTop,
y: points.cfHem.y + sa + 75,
y: points.cfHem.y + sa + 75
})
macro('vd', {
from: points.sideHem,
to: points.bustDartBottom,
x: points.bustDartTop.x + sa + 15,
x: points.bustDartTop.x + sa + 15
})
macro('vd', {
from: points.sideHem,
to: points.bustDartTop,
x: points.bustDartTop.x + sa + 30,
x: points.bustDartTop.x + sa + 30
})
macro('vd', {
from: points.sideHem,
to: points.armhole,
x: points.bustDartTop.x + sa + 45,
x: points.bustDartTop.x + sa + 45
})
macro('vd', {
from: points.sideHem,
to: points.armholePitch,
x: points.bustDartTop.x + sa + 60,
x: points.bustDartTop.x + sa + 60
})
macro('vd', {
from: points.sideHem,
to: points.shoulder,
x: points.bustDartTop.x + sa + 75,
x: points.bustDartTop.x + sa + 75
})
macro('hd', {
from: points.cfNeck,
to: points.hps,
y: points.hps.y - sa - 15,
y: points.hps.y - sa - 15
})
macro('hd', {
from: points.cfNeck,
to: points.armholePitch,
y: points.hps.y - sa - 30,
y: points.hps.y - sa - 30
})
macro('hd', {
from: points.cfNeck,
to: points.shoulder,
y: points.hps.y - sa - 45,
y: points.hps.y - sa - 45
})
macro('hd', {
from: points.cfNeck,
to: points.armhole,
y: points.hps.y - sa - 60,
y: points.hps.y - sa - 60
})
}
}

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let { Point, points, Path, paths, complete, macro, sa, store, paperless } = part.shorthand()
points.bandBottomLeft = points.bandBottomLeft.shift(0, 0)
@ -30,10 +30,7 @@ export default function(part) {
})
}
if (sa) {
paths.sa = paths.seam
.offset(sa)
.attr('class', 'fabric sa')
.setRender(true)
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa').setRender(true)
}
macro('title', {
at: points.titleAnchor,

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
options,
Point,
@ -46,10 +46,7 @@ export default function(part) {
})
}
if (sa) {
paths.sa = paths.seam
.offset(sa)
.attr('class', 'fabric sa')
.setRender(true)
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa').setRender(true)
}
macro('title', {
at: points.titleAnchor,

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
options,
Point,
@ -46,10 +46,7 @@ export default function(part) {
})
}
if (sa) {
paths.sa = paths.seam
.offset(sa)
.attr('class', 'fabric sa')
.setRender(true)
paths.sa = paths.seam.offset(sa).attr('class', 'fabric sa').setRender(true)
}
macro('title', {
at: points.titleAnchor,

View file

@ -11,13 +11,13 @@ import draftUnderSleeve from './undersleeve'
const Pattern = new freesewing.Design(config, plugins)
// Attach draft methods from Brian to prototype
Pattern.prototype.draftBase = function(part) {
Pattern.prototype.draftBase = function (part) {
return new Brian(this.settings).draftBase(part)
}
Pattern.prototype.draftFront = function(part) {
Pattern.prototype.draftFront = function (part) {
return new Brian(this.settings).draftFront(part)
}
Pattern.prototype.draftBack = function(part) {
Pattern.prototype.draftBack = function (part) {
return new Brian(this.settings).draftBack(part)
}

View file

@ -1,4 +1,4 @@
export default function(part, s) {
export default function (part, s) {
let { macro, points, sa } = part.shorthand()
macro('ld', {

View file

@ -1,6 +1,6 @@
import dimensions from './shared'
export default function(part) {
export default function (part) {
let { macro, Path, points, paths, complete, paperless, snippets, Snippet, sa } = part.shorthand()
// Extract seamline from sleeve
@ -10,7 +10,7 @@ export default function(part) {
// Complete?
if (complete) {
macro('scalebox', { at: points.elbowCenter, })
macro('scalebox', { at: points.elbowCenter })
snippets.logo = new Snippet('logo', points.elbowCenter.shift(90, 50))
macro('title', {
at: points.armCenter,

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let {
sa,
points,
@ -91,10 +91,7 @@ export default part => {
// Insert darts
if (options.waistDart) {
let dart = new Path()
.line(points.waistDart1)
.line(points.waistDartTip)
.line(points.waistDart2)
let dart = new Path().line(points.waistDart1).line(points.waistDartTip).line(points.waistDart2)
paths.seam = paths.seam.insop('waistDart', dart)
let saDart = new Path()
.line(points.waistDart1)
@ -165,10 +162,7 @@ export default part => {
store.set('backSideSeamLength', points.armhole.dist(points.waist))
store.set(
'backCollarLength',
new Path()
.move(points.cbNeck)
._curve(points.hpsCp2, points.hps)
.length() * 2
new Path().move(points.cbNeck)._curve(points.hpsCp2, points.hps).length() * 2
)
// Anchor point

View file

@ -46,7 +46,7 @@ export const getDartInsertionPoint = (points, utils, loc, angle) => {
}
// What points need to be rotated after cutting the primary bust dart
export const getPrimaryDartRotationList = loc => {
export const getPrimaryDartRotationList = (loc) => {
let rotate = ['cfWaist']
if (loc >= 1100) rotate.push('cfNeck')
if (loc >= 1130) rotate.push('hpsCp2')
@ -74,7 +74,7 @@ export const getSecondaryDartRotationList = (loc1, loc2) => {
return rotate
}
export const getDartLocationsAsNumbers = options => {
export const getDartLocationsAsNumbers = (options) => {
let loc1 = options.primaryBustDart
let loc2 = options.secondaryBustDart
loc1 = Number(loc1.slice(0, 2) + loc1.slice(-2))

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('secondaryBustDartLocation')) {

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { points, Path, store } = part.shorthand()
switch (store.get('primaryBustDartLocation')) {

View file

@ -18,7 +18,7 @@ import {
getSaDartPaths
} from './dart-utils'
export default part => {
export default (part) => {
let {
options,
store,

View file

@ -39,10 +39,7 @@ export default (part) => {
macro('title', { at: points.title, nr: 2, title: 'back' })
snippets.armholePitchNotch = new Snippet('bnotch', points.armholePitch)
paths.waist = new Path()
.move(points.cbWaist)
.line(points.waist)
.attr('class', 'help')
paths.waist = new Path().move(points.cbWaist).line(points.waist).attr('class', 'help')
if (sa) {
paths.sa = paths.saBase
.offset(sa)

View file

@ -53,10 +53,7 @@ export default (part) => {
})
macro('title', { at: points.title, nr: 1, title: 'front' })
snippets.armholePitchNotch = new Snippet('notch', points.armholePitch)
paths.waist = new Path()
.move(points.cfWaist)
.line(points.waist)
.attr('class', 'help')
paths.waist = new Path().move(points.cfWaist).line(points.waist).attr('class', 'help')
if (sa) {
paths.sa = paths.saBase
.offset(sa)

View file

@ -1,6 +1,6 @@
import init from './init'
export default function(part) {
export default function (part) {
let {
store,
sa,

View file

@ -11,9 +11,9 @@ import draftInset from './inset'
const Pattern = new freesewing.Design(config, plugins)
// Attach draft methods to prototype
Pattern.prototype.draftBack = part => draftBack(part)
Pattern.prototype.draftSide = part => draftSide(part)
Pattern.prototype.draftInset = part => draftInset(part)
Pattern.prototype.draftFront = part => draftFront(part)
Pattern.prototype.draftBack = (part) => draftBack(part)
Pattern.prototype.draftSide = (part) => draftSide(part)
Pattern.prototype.draftInset = (part) => draftInset(part)
Pattern.prototype.draftFront = (part) => draftFront(part)
export default Pattern

View file

@ -1,6 +1,6 @@
import init from './init'
export default function(part) {
export default function (part) {
let {
store,
sa,
@ -52,10 +52,7 @@ export default function(part) {
paths.hemBase = new Path().move(points.bottomRight).line(points.bottomLeft)
paths.saBase.render = false
paths.hemBase.render = false
paths.seam = paths.saBase
.join(paths.hemBase)
.close()
.attr('class', 'fabric')
paths.seam = paths.saBase.join(paths.hemBase).close().attr('class', 'fabric')
// Anchor point for sampling
points.anchor = points.topLeft

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
paperless,
sa,
@ -253,21 +253,14 @@ export default function(part) {
._curve(points.lapelStraightEndCp1, points.lapelStraightEnd)
.line(points.hemEdge)
.line(points.flbHem)
paths.seam = paths.saBase
.clone()
.line(points.psHem)
.close()
.attr('class', 'fabric')
paths.seam = paths.saBase.clone().line(points.psHem).close().attr('class', 'fabric')
paths.rollLine = new Path()
.move(points.rollLineStart)
.line(points.rollLineEnd)
.attr('class', 'lashed')
paths.flb = new Path()
.move(points.flbHem)
.line(points.flbTop)
.attr('class', 'lining lashed')
paths.flb = new Path().move(points.flbHem).line(points.flbTop).attr('class', 'lining lashed')
paths.pocket = new Path()
.move(

View file

@ -16,7 +16,7 @@ let fromBent = ['Base', 'Front', 'Back', 'Sleeve', 'TopSleeve', 'UnderSleeve']
// Attach draft methods from Bent to prototype
for (let m of fromBent) {
Pattern.prototype['draftBent' + m] = function(part) {
Pattern.prototype['draftBent' + m] = function (part) {
return new Bent(this.settings)['draft' + m](part)
}
}
@ -40,12 +40,12 @@ for (let m of [
'draftInnerPocketBag',
'draftInnerPocketTab'
]) {
Pattern.prototype[m] = function(part) {
Pattern.prototype[m] = function (part) {
return new Carlton(this.settings)[m](part)
}
}
Pattern.prototype.draftCarltonFront = function(part) {
Pattern.prototype.draftCarltonFront = function (part) {
return new Carlton(this.settings).draftFront(part)
}

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
units,
paperless,

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let { paperless, sa, store, complete, points, macro, Point, paths, Path } = part.shorthand()
points.topLeft = new Point(0, 0)
@ -17,10 +17,7 @@ export default function(part) {
.close()
.attr('class', 'fabric')
paths.fold = new Path()
.move(points.topMid)
.line(points.bottomMid)
.attr('class', 'dashed')
paths.fold = new Path().move(points.topMid).line(points.bottomMid).attr('class', 'dashed')
if (complete) {
points.title = new Point(points.bottomRight.x / 4, points.bottomRight.y / 2)

View file

@ -4,7 +4,7 @@
* but gets complicated when doing it in code.
*/
export default function(part) {
export default function (part) {
let { paperless, sa, complete, points, options, macro, paths, Path } = part.shorthand()
// We're going to slash and spread this collar. Slashing first:
@ -165,11 +165,7 @@ export default function(part) {
.line(points.rot4bottomRight)
.line(points.rot4topRight)
._curve(points.topLeftCp, points.topLeft)
paths.seam = paths.saBase
.clone()
.line(points.standTop)
.close()
.attr('class', 'fabric')
paths.seam = paths.saBase.clone().line(points.standTop).close().attr('class', 'fabric')
if (complete) {
points.title = points.standTopCp.clone()

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let { paperless, sa, store, complete, points, macro, Point, paths, Path } = part.shorthand()
points.topLeft = new Point(0, 0)

View file

@ -26,22 +26,22 @@ import draftInnerPocketTab from './innerpockettab'
const Pattern = new freesewing.Design(config, [plugins, buttons])
// Attach draft methods from Bent to prototype
Pattern.prototype.draftBentBase = function(part) {
Pattern.prototype.draftBentBase = function (part) {
return new Bent(this.settings).draftBase(part)
}
Pattern.prototype.draftBentFront = function(part) {
Pattern.prototype.draftBentFront = function (part) {
return new Bent(this.settings).draftFront(part)
}
Pattern.prototype.draftBentBack = function(part) {
Pattern.prototype.draftBentBack = function (part) {
return new Bent(this.settings).draftBack(part)
}
Pattern.prototype.draftBentSleeve = function(part) {
Pattern.prototype.draftBentSleeve = function (part) {
return new Bent(this.settings).draftSleeve(part)
}
Pattern.prototype.draftBentTopSleeve = function(part) {
Pattern.prototype.draftBentTopSleeve = function (part) {
return new Bent(this.settings).draftTopSleeve(part)
}
Pattern.prototype.draftBentUnderSleeve = function(part) {
Pattern.prototype.draftBentUnderSleeve = function (part) {
return new Bent(this.settings).draftUnderSleeve(part)
}

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
units,
paperless,

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let { paperless, sa, store, complete, points, macro, Point, paths, Path } = part.shorthand()
points.topLeft = new Point(0, 0)
@ -17,10 +17,7 @@ export default function(part) {
.close()
.attr('class', 'lining')
paths.hint = new Path()
.move(points.top)
.line(points.bottom)
.attr('class', 'lining dashed')
paths.hint = new Path().move(points.top).line(points.bottom).attr('class', 'lining dashed')
if (complete) {
points.title = points.top.shiftFractionTowards(points.bottom, 0.5)

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let { paperless, sa, store, complete, points, macro, Point, paths, Path } = part.shorthand()
points.topLeft = new Point(0, 0)
@ -27,10 +27,7 @@ export default function(part) {
.close()
.attr('class', 'fabric')
paths.fold = new Path()
.move(points.leftMid)
.line(points.rightMid)
.attr('class', 'dashed')
paths.fold = new Path().move(points.leftMid).line(points.rightMid).attr('class', 'dashed')
paths.welt = new Path()
.move(points.realTopLeft)

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
paperless,
sa,
@ -41,10 +41,7 @@ export default function(part) {
.line(points.roundRightStart)
.curve(points.roundRightCp1, points.roundRightCp2, points.roundRightEnd)
} else {
paths.seam = new Path()
.move(points.edgeLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
paths.seam = new Path().move(points.edgeLeft).line(points.bottomLeft).line(points.bottomRight)
}
paths.seam = paths.seam
@ -53,10 +50,7 @@ export default function(part) {
.close()
.attr('class', 'fabric')
paths.fold = new Path()
.move(points.topLeft)
.line(points.topRight)
.attr('class', 'fabric dashed')
paths.fold = new Path().move(points.topLeft).line(points.topRight).attr('class', 'fabric dashed')
if (complete) {
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
paperless,
sa,
@ -39,17 +39,10 @@ export default function(part) {
.line(points.roundRightStart)
.curve(points.roundRightCp1, points.roundRightCp2, points.roundRightEnd)
} else {
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
paths.seam = new Path().move(points.topLeft).line(points.bottomLeft).line(points.bottomRight)
}
paths.seam = paths.seam
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'fabric')
paths.seam = paths.seam.line(points.topRight).line(points.topLeft).close().attr('class', 'fabric')
if (complete) {
points.title = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5)

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
paperless,
sa,
@ -37,17 +37,10 @@ export default function(part) {
.line(points.roundRightStart)
.curve(points.roundRightCp1, points.roundRightCp2, points.roundRightEnd)
} else {
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
paths.seam = new Path().move(points.topLeft).line(points.bottomLeft).line(points.bottomRight)
}
paths.seam = paths.seam
.line(points.topRight)
.line(points.topLeft)
.close()
.attr('class', 'lining')
paths.seam = paths.seam.line(points.topRight).line(points.topLeft).close().attr('class', 'lining')
delete paths.fold

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
units,
paperless,
@ -79,11 +79,7 @@ export default function(part) {
to: points.fold2Top.shift(0, 10)
})
if (sa)
paths.sa = paths.seam
.offset(sa)
.close()
.attr('class', 'fabric sa')
if (sa) paths.sa = paths.seam.offset(sa).close().attr('class', 'fabric sa')
macro('vd', {
from: points.fold4Bottom.shift(0, 15),
to: points.fold4Top.shift(0, 15),

View file

@ -3,7 +3,7 @@ function Attributes() {
}
/** Adds an attribute */
Attributes.prototype.add = function(name, value) {
Attributes.prototype.add = function (name, value) {
if (typeof this.list[name] === 'undefined') {
this.list[name] = []
}
@ -13,33 +13,33 @@ Attributes.prototype.add = function(name, value) {
}
/** Sets an attribute, overwriting existing value */
Attributes.prototype.set = function(name, value) {
Attributes.prototype.set = function (name, value) {
this.list[name] = [value]
return this
}
/** Removes an attribute */
Attributes.prototype.remove = function(name) {
Attributes.prototype.remove = function (name) {
delete this.list[name]
return this
}
/** Retrieves an attribute */
Attributes.prototype.get = function(name) {
Attributes.prototype.get = function (name) {
if (typeof this.list[name] === 'undefined') return false
else return this.list[name].join(' ')
}
/** Retrieves an attribute as array*/
Attributes.prototype.getAsArray = function(name) {
Attributes.prototype.getAsArray = function (name) {
if (typeof this.list[name] === 'undefined') return false
else return this.list[name]
}
/** Returns SVG code for attributes */
Attributes.prototype.render = function() {
Attributes.prototype.render = function () {
let svg = ''
for (let key in this.list) {
svg += ` ${key}="${this.list[key].join(' ')}"`
@ -49,7 +49,7 @@ Attributes.prototype.render = function() {
}
/** Returns CSS code for attributes */
Attributes.prototype.renderAsCss = function() {
Attributes.prototype.renderAsCss = function () {
let css = ''
for (let key in this.list) {
css += ` ${key}:${this.list[key].join(' ')};`
@ -60,7 +60,7 @@ Attributes.prototype.renderAsCss = function() {
/** Returns SVG code for attributes with a fiven prefix
* typically used for data-text*/
Attributes.prototype.renderIfPrefixIs = function(prefix = '') {
Attributes.prototype.renderIfPrefixIs = function (prefix = '') {
let svg = ''
let prefixLen = prefix.length
for (let key in this.list) {
@ -74,7 +74,7 @@ Attributes.prototype.renderIfPrefixIs = function(prefix = '') {
/** Returns a props object for attributes with a fiven prefix
* typically used for data-text*/
Attributes.prototype.asPropsIfPrefixIs = function(prefix = '') {
Attributes.prototype.asPropsIfPrefixIs = function (prefix = '') {
let props = {}
let prefixLen = prefix.length
for (let key in this.list) {
@ -89,7 +89,7 @@ Attributes.prototype.asPropsIfPrefixIs = function(prefix = '') {
}
/** Returns a deep copy of this */
Attributes.prototype.clone = function() {
Attributes.prototype.clone = function () {
let clone = new Attributes()
clone.list = JSON.parse(JSON.stringify(this.list))

View file

@ -53,7 +53,7 @@ export function register(config) {
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
.then((registration) => {
registration.onupdatefound = () => {
const installingWorker = registration.installing
installingWorker.onstatechange = () => {
@ -84,7 +84,7 @@ function registerValidSW(swUrl, config) {
}
}
})
.catch(error => {
.catch((error) => {
console.error('Error during service worker registration:', error)
})
}
@ -92,14 +92,14 @@ function registerValidSW(swUrl, config) {
function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
.then((response) => {
// Ensure service worker exists, and that we really are getting a JS file.
if (
response.status === 404 ||
response.headers.get('content-type').indexOf('javascript') === -1
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => {
window.location.reload()
})
@ -116,7 +116,7 @@ function checkValidServiceWorker(swUrl, config) {
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
navigator.serviceWorker.ready.then((registration) => {
registration.unregister()
})
}

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
options,
Point,

View file

@ -10,16 +10,16 @@ import draftSleeve from './sleeve'
const Pattern = new freesewing.Design(config, plugins)
// Attach draft methods to prototype
Pattern.prototype.draftBase = function(part) {
Pattern.prototype.draftBase = function (part) {
return new Brian(this.settings).draftBase(part)
}
Pattern.prototype.draftFrontBase = function(part) {
Pattern.prototype.draftFrontBase = function (part) {
return new Brian(this.settings).draftFront(part)
}
Pattern.prototype.draftBackBase = function(part) {
Pattern.prototype.draftBackBase = function (part) {
return new Brian(this.settings).draftBack(part)
}
Pattern.prototype.draftSleeveBase = function(part) {
Pattern.prototype.draftSleeveBase = function (part) {
let brian = new Brian(this.settings)
return brian.draftSleeve(brian.draftSleevecap(part))
}

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, paths, Path } = part.shorthand()
points.origin = new Point(10, 10)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, options } = part.shorthand()
/**

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.from = new Point(5, 20)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.B = new Point(10, 50)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.example = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.example = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
paths.clone = paths.example
.clone()

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.from = new Point(10, 20)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.from = new Point(10, 20)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.from = new Point(10, 20)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.A = new Point(55, 40)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.demo = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.demo = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
snippets.end = new Snippet('notch', paths.demo.end())

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(95, 50)
@ -12,10 +12,7 @@ export default part => {
points.top = new Point(60, -10)
points.bot = new Point(60, 140)
paths.line = new Path()
.move(points.top)
.line(points.bot)
.attr('class', 'lining dashed')
paths.line = new Path().move(points.top).line(points.bot).attr('class', 'lining dashed')
paths.demo = new Path()
.move(points.A)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(55, 40)
@ -12,10 +12,7 @@ export default part => {
points.top = new Point(10, 58)
points.bot = new Point(130, 58)
paths.line = new Path()
.move(points.top)
.line(points.bot)
.attr('class', 'lining dashed')
paths.line = new Path().move(points.top).line(points.bot).attr('class', 'lining dashed')
paths.demo = new Path()
.move(points.A)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.path1 = new Path()
.move(points.A)
.line(points.B)
.attr('class', 'various')
paths.path1 = new Path().move(points.A).line(points.B).attr('class', 'various')
paths.path2 = new Path()
.move(points.B)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.example = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.example = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
macro('pd', {
path: paths.example,

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.from = new Point(10, 10)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.to = new Point(50, 10)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.A = new Point(45, 60)
@ -16,11 +16,7 @@ export default part => {
paths.offset = paths.example.offset(-10).attr('class', 'interfacing')
paths.lineOffset = new Path()
.move(points.A)
.line(points.B)
.offset(-5)
.attr('class', 'various')
paths.lineOffset = new Path().move(points.A).line(points.B).offset(-5).attr('class', 'various')
paths.curveOffset = new Path()
.move(points.B)

View file

@ -1,7 +1,7 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, options } = part.shorthand()
const textClasses = label =>
const textClasses = (label) =>
options.focus === label ? 'center text-xs fill-note' : 'center text-xs'
points.A = new Point(10, 10)
@ -46,11 +46,7 @@ export default part => {
.attr('data-text', 'Path.close()')
.attr('data-text-class', textClasses('close'))
paths.example = paths.line
.join(paths.curve)
.join(paths._curve)
.join(paths.curve_)
.close()
paths.example = paths.line.join(paths.curve).join(paths._curve).join(paths.curve_).close()
return part
}

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.B = new Point(10, 30)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.example = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.example = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
points.x1 = paths.example
.shiftAlong(20)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.example = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.example = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
points.x1 = paths.example
.shiftFractionAlong(0.2)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.example = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.example = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
snippets.start = new Snippet('notch', paths.example.start())
return part

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.A = new Point(45, 60)
@ -7,10 +7,7 @@ export default part => {
points.C = new Point(90, 30)
points.CCp1 = new Point(50, -30)
paths.A = new Path()
.move(points.A)
.line(points.B)
.curve(points.BCp2, points.CCp1, points.C)
paths.A = new Path().move(points.A).line(points.B).curve(points.BCp2, points.CCp1, points.C)
paths.B = paths.A.translate(60, 30)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.center = new Point(0, 0)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.A = new Point(0, 0)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, snippets, Snippet } = part.shorthand()
snippets.logo = new Snippet('logo', new Point(50, 30))

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.topLeft = new Point(0, 0)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.anchor1 = new Point(0, 0)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.a = new Point(10, 10)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.title = new Point(90, 45)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.sun = new Point(10, 5)
@ -8,10 +8,7 @@ export default part => {
.attr('data-text', points.sun.angle(points.moon) + '°')
.attr('data-text-class', 'text-sm fill-note center')
paths.line = new Path()
.move(points.sun)
.line(points.moon)
.attr('class', 'dashed')
paths.line = new Path().move(points.sun).line(points.moon).attr('class', 'dashed')
return part
}

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points } = part.shorthand()
points.anchor = new Point(100, 25)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
points.A = new Point(25, 25)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
points.A = new Point(50, 25).attr('data-text', 'Point A').attr('data-text-class', 'text-xl')

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.from = new Point(10, 10)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.from = new Point(10, 10)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.from = new Point(10, 10)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.top = new Point(50, 10)
@ -39,10 +39,7 @@ export default part => {
.line(points._out1)
.close()
paths.mirror = new Path()
.move(points.top)
.line(points.bottom)
.attr('class', 'note dashed')
paths.mirror = new Path().move(points.top).line(points.bottom).attr('class', 'note dashed')
return part
}

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.start = new Point(0, 50)

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.sun = new Point(40, 40)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.A = new Point(90, 40).attr('data-text', 'Point A').attr('data-text-class', 'right')

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.A = new Point(90, 70).attr('data-text', 'Point A')
@ -8,10 +8,7 @@ export default part => {
.attr('data-text-class', 'center')
.attr('data-text-lineheight', 6)
paths.direction = new Path()
.move(points.A)
.line(points.B)
.attr('class', 'note dashed')
paths.direction = new Path().move(points.A).line(points.B).attr('class', 'note dashed')
macro('ld', {
from: points.C,

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.A = new Point(90, 70).attr('data-text', 'Point A')
@ -9,10 +9,7 @@ export default part => {
.attr('data-text', 'Point C is point A shifted 3cm\nbeyond point B')
.attr('data-text-lineheight', 6)
paths.direction = new Path()
.move(points.A)
.line(points.C)
.attr('class', 'note dashed')
paths.direction = new Path().move(points.A).line(points.C).attr('class', 'note dashed')
macro('ld', {
from: points.C,

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths, macro } = part.shorthand()
points.A = new Point(90, 70).attr('data-text', 'Point A')
@ -10,10 +10,7 @@ export default part => {
.attr('data-text-class', 'center')
.attr('data-text-lineheight', 6)
paths.direction = new Path()
.move(points.A)
.line(points.B)
.attr('class', 'note dashed')
paths.direction = new Path().move(points.A).line(points.B).attr('class', 'note dashed')
macro('ld', {
from: points.C,

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
let s

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
box(part)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, macro } = part.shorthand()
points.A = new Point(20, 20).attr('data-text', 'Point A')

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths } = part.shorthand()
points.A = new Point(45, 60)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
points.anchor1 = new Point(20, 15)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
points.anchor = new Point(50, 15)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Snippet, snippets } = part.shorthand()
points.anchor = new Point(35, 35)

View file

@ -1,6 +1,6 @@
import { box } from './shared'
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets, utils } = part.shorthand()
points.A = new Point(95, 45).attr('data-circle', 35).attr('data-circle-class', 'fabric')

View file

@ -1,4 +1,4 @@
export default part => {
export default (part) => {
let { Point, points, Path, paths, Snippet, snippets, utils } = part.shorthand()
points.A = new Point(10, 10)

Some files were not shown because too many files have changed in this diff Show more