1
0
Fork 0

fix(hugo): Render fully-sized parts when complete is falsy

This commit is contained in:
Joost De Cock 2020-04-18 17:51:58 +02:00
parent e4d69a9bf8
commit eb4764d1d6
2 changed files with 72 additions and 47 deletions

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
store,
sa,
@ -13,31 +13,42 @@ export default function(part) {
} = part.shorthand()
let width = store.get('hoodCenterWidth')
let length = complete ? width * 2.5 : store.get('hoodCenterLength')
points.topLeft = new Point(0, 0)
points.bottomLeft = new Point(0, width)
points.topMidLeft = new Point(width, 0)
points.bottomMidLeft = new Point(width, width)
points.topMidRight = new Point(width * 1.5, 0)
points.bottomMidRight = new Point(width * 1.5, width)
points.topRight = new Point(width * 2.5, 0)
points.bottomRight = new Point(width * 2.5, width)
points.topRight = new Point(length, 0)
points.bottomRight = new Point(length, width)
paths.seam = new Path()
.move(points.topMidLeft)
.line(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomMidLeft)
.move(points.bottomMidRight)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topMidRight)
.attr('class', 'fabric')
paths.hint = new Path()
.move(points.topMidLeft)
.line(points.topMidRight)
.move(points.bottomMidLeft)
.line(points.bottomMidRight)
.attr('class', 'fabric dashed')
if (complete) {
paths.seam = new Path()
.move(points.topMidLeft)
.line(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomMidLeft)
.move(points.bottomMidRight)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topMidRight)
.attr('class', 'fabric')
paths.hint = new Path()
.move(points.topMidLeft)
.line(points.topMidRight)
.move(points.bottomMidLeft)
.line(points.bottomMidRight)
.attr('class', 'fabric dashed')
} else {
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.close()
.attr('class', 'fabric')
}
// Complete pattern?
if (complete) {
@ -57,15 +68,14 @@ export default function(part) {
y: points.bottomRight.y + sa + 15,
text: units(store.get('hoodCenterLength'))
})
}
// Paperless?
if (paperless) {
macro('vd', {
from: points.bottomRight,
to: points.topRight,
x: points.topRight.x + sa + 15
})
// Paperless?
if (paperless) {
macro('vd', {
from: points.bottomRight,
to: points.topRight,
x: points.topRight.x + sa + 15
})
}
}
return part

View file

@ -1,4 +1,4 @@
export default function(part) {
export default function (part) {
let {
measurements,
options,
@ -14,32 +14,47 @@ export default function(part) {
} = part.shorthand()
let width = measurements.hpsToHipsBack * options.ribbingHeight * 2
let length = complete
? width * 2.5
: measurements.chestCircumference * (1 + options.chestEase) * (1 - options.ribbingStretch)
// We only print a part, unless complete is false in which case
// we print the entire thing (because laser cutters and so on)
points.topLeft = new Point(0, 0)
points.bottomLeft = new Point(0, width)
points.topMidLeft = new Point(width, 0)
points.bottomMidLeft = new Point(width, width)
points.topMidRight = new Point(width * 1.5, 0)
points.bottomMidRight = new Point(width * 1.5, width)
points.topRight = new Point(width * 2.5, 0)
points.bottomRight = new Point(width * 2.5, width)
points.topRight = new Point(length, 0)
points.bottomRight = new Point(length, width)
paths.seam = new Path()
.move(points.topMidLeft)
.line(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomMidLeft)
.move(points.bottomMidRight)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topMidRight)
.attr('class', 'fabric')
paths.hint = new Path()
.move(points.topMidLeft)
.line(points.topMidRight)
.move(points.bottomMidLeft)
.line(points.bottomMidRight)
.attr('class', 'fabric dashed')
if (complete) {
paths.seam = new Path()
.move(points.topMidLeft)
.line(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomMidLeft)
.move(points.bottomMidRight)
.line(points.bottomRight)
.line(points.topRight)
.line(points.topMidRight)
.attr('class', 'fabric')
paths.hint = new Path()
.move(points.topMidLeft)
.line(points.topMidRight)
.move(points.bottomMidLeft)
.line(points.bottomMidRight)
.attr('class', 'fabric dashed')
} else {
paths.seam = new Path()
.move(points.topLeft)
.line(points.bottomLeft)
.line(points.bottomRight)
.line(points.topRight)
.close()
.attr('class', 'fabric')
}
// Complete pattern?
if (complete) {