1
0
Fork 0

chore: Linter run

This commit is contained in:
joostdecock 2021-09-04 13:27:13 +02:00
parent 8da0b5823d
commit 6d3cee78d9
15 changed files with 152 additions and 167 deletions

View file

@ -11,9 +11,17 @@ export default {
type: 'pattern',
difficulty: 3,
optionGroups: {
fit: ['headEase'],
style: ['lengthRatio', 'goreNumber', 'visorAngle', 'visorWidth','earLength','earWidth','buttonhole'],
advanced:['visorLength'],
fit: ['headEase'],
style: [
'lengthRatio',
'goreNumber',
'visorAngle',
'visorWidth',
'earLength',
'earWidth',
'buttonhole',
],
advanced: ['visorLength'],
},
measurements: ['head'],
dependencies: {},
@ -21,14 +29,14 @@ export default {
hide: [],
parts: ['gore', 'visor', 'ear'],
options: {
headEase: { mm: 19, min: 0, max: 50 },
headEase: { mm: 19, min: 0, max: 50 },
lengthRatio: { pct: 55, min: 40, max: 60 },
goreNumber: { count: 6, min: 4, max: 20 },
visorAngle: { deg: 45, min: 10, max: 90 },
visorWidth: { mm: 30, min: 5, max: 100 },
earLength: { pct: 100, min: 80, max: 150 },
earWidth: { pct: 100, min: 80, max: 150 },
visorLength: { pct: 100, min: 80, max: 150 },
buttonhole: {bool: false}
earLength: { pct: 100, min: 80, max: 150 },
earWidth: { pct: 100, min: 80, max: 150 },
visorLength: { pct: 100, min: 80, max: 150 },
buttonhole: { bool: false },
},
}

View file

@ -15,9 +15,9 @@ export default function (part) {
} = part.shorthand()
// Design pattern here
let headCircumference = measurements.head + options.headEase
let earFlapLength = ((options.lengthRatio * headCircumference) / 2)*options.earLength
let earFlapWidth = (headCircumference / 12)*options.earWidth
let headCircumference = measurements.head + options.headEase
let earFlapLength = ((options.lengthRatio * headCircumference) / 2) * options.earLength
let earFlapWidth = (headCircumference / 12) * options.earWidth
points.top = new Point(0, 0)
points.bottom = new Point(earFlapWidth, earFlapLength)
points.topC = points.top.shift(0, points.bottom.x)
@ -25,15 +25,13 @@ let earFlapWidth = (headCircumference / 12)*options.earWidth
points.topCFlipped = points.topC.flipX()
points.bottomFlipped = points.bottom.flipX()
points.bottomCFlipped = points.bottomC.flipX()
paths.seam = new Path()
paths.seam = new Path()
.move(points.bottom)
.curve(points.bottomC, points.topC, points.top)
.curve(points.bottomC, points.topC, points.top)
.curve(points.topCFlipped, points.bottomCFlipped, points.bottomFlipped)
paths.hem = new Path()
.move(points.bottomFlipped)
.line(points.bottom)
paths.hem = new Path().move(points.bottomFlipped).line(points.bottom)
// Complete?
if (complete) {
macro('grainline', { from: points.top, to: new Point(0, points.bottom.y) })
@ -42,16 +40,17 @@ let earFlapWidth = (headCircumference / 12)*options.earWidth
points.title = new Point(0.3 * points.bottom.x, 0.75 * points.bottom.y)
macro('title', { at: points.title, nr: 3, title: 'ear flap', scale: 0.5 })
macro('miniscale', { at: new Point(0, points.bottom.y * 0.3) })
if (options.buttonhole){
let buttonholeDistance = (options.lengthRatio * headCircumference) / 2
points.buttonhole = new Point (points.top.x, points.bottom.y - buttonholeDistance)
snippets.buttonhole = new Snippet('buttonhole-start', points.buttonhole).attr('data-scale', 2)
}
if (options.buttonhole) {
let buttonholeDistance = (options.lengthRatio * headCircumference) / 2
points.buttonhole = new Point(points.top.x, points.bottom.y - buttonholeDistance)
snippets.buttonhole = new Snippet('buttonhole-start', points.buttonhole).attr('data-scale', 2)
}
if (sa) {
paths.sa = paths.seam.offset(sa)
.join(paths.hem.offset(sa*2))
.attr('class', 'fabric sa')
.close()
paths.sa = paths.seam
.offset(sa)
.join(paths.hem.offset(sa * 2))
.attr('class', 'fabric sa')
.close()
}
// Paperless?
@ -66,13 +65,13 @@ let earFlapWidth = (headCircumference / 12)*options.earWidth
to: points.top,
x: points.bottomFlipped.x - 15 - sa,
})
if (options.buttonhole){
macro('vd', {
from: points.bottom,
to: points.buttonhole,
x: points.bottom.x + 15 + sa,
})
}
if (options.buttonhole) {
macro('vd', {
from: points.bottom,
to: points.buttonhole,
x: points.bottom.x + 15 + sa,
})
}
}
}
return part

View file

@ -37,19 +37,19 @@ export default function (part) {
.curve(points.gore_Cp1, points.gore_Cp2, points.gore_p2)
.offset(sa)
.setRender(false)
points.sa1 = new Point(points.gore_p3.x - (sa*2), points.gore_p3.y - sa)
paths.saBase = new Path()
.move(points.gore_p3)
points.sa1 = new Point(points.gore_p3.x - sa * 2, points.gore_p3.y - sa)
paths.saBase = new Path()
.move(points.gore_p3)
.line(points.p0)
.offset(sa*2)
.setRender(false)
.offset(sa * 2)
.setRender(false)
paths.sa = new Path()
.move(points.gore_p1)
.line(points.gore_p1.shift(0, sa))
.line(paths.saCurve.start())
.join(paths.saCurve)
.line(points.sa1)
.join(paths.saBase)
.line(points.sa1)
.join(paths.saBase)
.line(points.p0)
.attr('class', 'fabric sa')
}

View file

@ -4,16 +4,16 @@ export default function (part) {
let headCircumference = measurements.head + options.headEase
let headRadius = headCircumference / 2 / Math.PI
let visorRadius = (headRadius / Math.sin((options.visorAngle * Math.PI) / 180))
let sectorAngle = (Math.PI / 3)*options.visorLength
let visorRadius = headRadius / Math.sin((options.visorAngle * Math.PI) / 180)
let sectorAngle = (Math.PI / 3) * options.visorLength
let visorSectorAngle = (sectorAngle * headRadius) / visorRadius
let cpDistance =
((4 / 3) * visorRadius * (1 - Math.cos(visorSectorAngle / 2))) / Math.sin(visorSectorAngle / 2)
((4 / 3) * visorRadius * (1 - Math.cos(visorSectorAngle / 2))) / Math.sin(visorSectorAngle / 2)
points.origin = new Point(0, 0)
points.in1 = new Point(0, 0)
points.in2 = points.in1.shift(
((90 / Math.PI) * visorSectorAngle),
(90 / Math.PI) * visorSectorAngle,
2 * visorRadius * Math.sin(visorSectorAngle / 2)
)
//test circle
@ -49,27 +49,26 @@ export default function (part) {
macro('title', { at: points.ex1.shift(45, 20), nr: 2, title: 'visor', scale: 0.4 })
if (sa) {
paths.saInner = new Path ()
.move(points.in2Flipped)
.curve(points.in2CFlipped, points.in1CFlipped, points.in1)
.curve(points.in1C, points.in2C, points.in2)
.offset(sa*-2)
.attr('class', 'fabric sa')
points.sa1 = new Point(points.in2Flipped.x-sa, paths.saInner.start().y)
points.sa2 = new Point(points.in2.x+sa, paths.saInner.start().y)
paths.sa = new Path()
.move(points.in2)
.curve(points.ex2C, points.ex1C, points.ex1)
.curve(points.ex1CFlipped, points.ex2CFlipped, points.in2Flipped)
.offset(sa*-1)
.line(points.sa1)
.join(paths .saInner)
.line(points.sa2)
.close()
.attr('class', 'fabric sa')
paths.saInner = new Path()
.move(points.in2Flipped)
.curve(points.in2CFlipped, points.in1CFlipped, points.in1)
.curve(points.in1C, points.in2C, points.in2)
.offset(sa * -2)
.attr('class', 'fabric sa')
points.sa1 = new Point(points.in2Flipped.x - sa, paths.saInner.start().y)
points.sa2 = new Point(points.in2.x + sa, paths.saInner.start().y)
paths.sa = new Path()
.move(points.in2)
.curve(points.ex2C, points.ex1C, points.ex1)
.curve(points.ex1CFlipped, points.ex2CFlipped, points.in2Flipped)
.offset(sa * -1)
.line(points.sa1)
.join(paths.saInner)
.line(points.sa2)
.close()
.attr('class', 'fabric sa')
}
// Paperless?
if (paperless) {
macro('hd', {