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

View file

@ -1,4 +1,4 @@
export default function(part) { export default function (part) {
let { let {
measurements, measurements,
options, options,
@ -14,32 +14,47 @@ export default function(part) {
} = part.shorthand() } = part.shorthand()
let width = measurements.hpsToHipsBack * options.ribbingHeight * 2 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.topLeft = new Point(0, 0)
points.bottomLeft = new Point(0, width) points.bottomLeft = new Point(0, width)
points.topMidLeft = new Point(width, 0) points.topMidLeft = new Point(width, 0)
points.bottomMidLeft = new Point(width, width) points.bottomMidLeft = new Point(width, width)
points.topMidRight = new Point(width * 1.5, 0) points.topMidRight = new Point(width * 1.5, 0)
points.bottomMidRight = new Point(width * 1.5, width) points.bottomMidRight = new Point(width * 1.5, width)
points.topRight = new Point(width * 2.5, 0) points.topRight = new Point(length, 0)
points.bottomRight = new Point(width * 2.5, width) points.bottomRight = new Point(length, width)
paths.seam = new Path() if (complete) {
.move(points.topMidLeft) paths.seam = new Path()
.line(points.topLeft) .move(points.topMidLeft)
.line(points.bottomLeft) .line(points.topLeft)
.line(points.bottomMidLeft) .line(points.bottomLeft)
.move(points.bottomMidRight) .line(points.bottomMidLeft)
.line(points.bottomRight) .move(points.bottomMidRight)
.line(points.topRight) .line(points.bottomRight)
.line(points.topMidRight) .line(points.topRight)
.attr('class', 'fabric') .line(points.topMidRight)
paths.hint = new Path() .attr('class', 'fabric')
.move(points.topMidLeft) paths.hint = new Path()
.line(points.topMidRight) .move(points.topMidLeft)
.move(points.bottomMidLeft) .line(points.topMidRight)
.line(points.bottomMidRight) .move(points.bottomMidLeft)
.attr('class', 'fabric dashed') .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? // Complete pattern?
if (complete) { if (complete) {