chore(core): Use hide, not render
This commit is contained in:
parent
026560ef24
commit
5dc7401308
82 changed files with 337 additions and 293 deletions
|
@ -44,7 +44,7 @@ export const front = {
|
|||
part,
|
||||
}) => {
|
||||
// Hide Brian paths
|
||||
for (let key of Object.keys(paths)) paths[key].render = false
|
||||
for (let key of Object.keys(paths)) paths[key].hide()
|
||||
|
||||
// Handle stretch
|
||||
for (let i in points) points[i].x = points[i].x * (1 - options.stretchFactor)
|
||||
|
|
|
@ -38,9 +38,7 @@ export const bandTie = {
|
|||
}) => {
|
||||
// band tie
|
||||
if (!options.ties) {
|
||||
if (!options.crossBackTies) {
|
||||
part.render = false
|
||||
}
|
||||
if (!options.crossBackTies) part.hide()
|
||||
}
|
||||
let bandTieLength
|
||||
if (options.crossBackTies)
|
||||
|
|
|
@ -40,9 +40,7 @@ export const neckTie = {
|
|||
part,
|
||||
}) => {
|
||||
// neck tie
|
||||
if (!options.ties) {
|
||||
part.render = false
|
||||
}
|
||||
if (!options.ties) part.hide()
|
||||
let neckTieLength
|
||||
if (options.crossBackTies)
|
||||
neckTieLength =
|
||||
|
|
|
@ -65,7 +65,7 @@ function draftBenjaminBase({
|
|||
points.titleAnchor = new Point(points.tip1Top.x, 0)
|
||||
|
||||
// Paths
|
||||
paths.cap = new Path().move(points.tip2Bottom)
|
||||
paths.cap = new Path().hide().move(points.tip2Bottom)
|
||||
if (options.endStyle === 'straight') {
|
||||
paths.cap = new Path().move(points.tip2Bottom).line(points.tip2Top)
|
||||
} else if (options.endStyle === 'pointed') {
|
||||
|
@ -87,7 +87,6 @@ function draftBenjaminBase({
|
|||
})
|
||||
paths.cap = paths.bottomRounded.join(paths.topRounded)
|
||||
}
|
||||
paths.cap.render = false
|
||||
|
||||
if (options.bowStyle === 'diamond' || options.bowStyle === 'butterfly') {
|
||||
const cpl = options.bowStyle === 'diamond' ? bow / 10 : bow / 4
|
||||
|
|
|
@ -13,10 +13,7 @@ function draftBenjaminBow2({
|
|||
paperless,
|
||||
part,
|
||||
}) {
|
||||
if (!options.adjustmentRibbon) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.adjustmentRibbon) return part.hide()
|
||||
|
||||
points.bandBottomLeft = points.bandBottomLeft.shift(180, 90)
|
||||
points.bandTopLeft = points.bandBottomLeft.flipY()
|
||||
|
|
|
@ -13,10 +13,7 @@ function draftBenjaminBow3({
|
|||
paperless,
|
||||
part,
|
||||
}) {
|
||||
if (!options.adjustmentRibbon) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.adjustmentRibbon) return part.hide()
|
||||
|
||||
points.bandBottomLeft = points.bandBottomLeft.shift(180, 290)
|
||||
points.bandTopLeft = points.bandBottomLeft.flipY()
|
||||
|
|
|
@ -12,10 +12,7 @@ function draftBenjaminRibbon({
|
|||
paperless,
|
||||
part,
|
||||
}) {
|
||||
if (options.adjustmentRibbon) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (options.adjustmentRibbon) return part.hide()
|
||||
|
||||
// Points
|
||||
points.bottomLeft = new Point(0, 0.5 * store.get('ribbonWidth'))
|
||||
|
|
|
@ -128,7 +128,7 @@ function draftBreannaBack({
|
|||
|
||||
paths.seam.close().attr('class', 'fabric')
|
||||
paths.saBase.close()
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
|
||||
// Store data
|
||||
if (options.shoulderDart) {
|
||||
|
|
|
@ -140,7 +140,7 @@ function draftBreannaFront({
|
|||
|
||||
// All done. Just set final path properties before we get to SA/final/paperless
|
||||
paths.seam.close().attr('class', 'fabric')
|
||||
paths.saBase.close().render = false
|
||||
paths.saBase.close().hide()
|
||||
|
||||
// Anchor point
|
||||
points.gridAnchor = points.cfNeck.clone()
|
||||
|
|
|
@ -39,7 +39,7 @@ function draftBreannaSleeve(params) {
|
|||
)
|
||||
|
||||
// Paths
|
||||
paths.sleevecap.render = false
|
||||
paths.sleevecap.hide()
|
||||
paths.seam = new Path()
|
||||
.move(points.bicepsLeft)
|
||||
.line(points.wristLeft)
|
||||
|
|
|
@ -32,7 +32,7 @@ export const front = {
|
|||
paths.frontCollar = new Path()
|
||||
.move(points.hps)
|
||||
.curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
} else if (options.s3Collar > 0) {
|
||||
// Shift shoulder seam forward on the collar side
|
||||
points.s3CollarSplit = utils.curveIntersectsY(
|
||||
|
@ -46,7 +46,7 @@ export const front = {
|
|||
.move(points.hps)
|
||||
.curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck)
|
||||
.split(points.s3CollarSplit)[1]
|
||||
.setRender(false)
|
||||
.hide()
|
||||
} else if (options.s3Collar < 0) {
|
||||
// Shift shoulder seam backward on the collar side
|
||||
points.s3CollarSplit = utils.curveIntersectsY(
|
||||
|
@ -64,14 +64,14 @@ export const front = {
|
|||
.join(
|
||||
new Path().move(points.hps).curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck)
|
||||
)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
}
|
||||
if (options.s3Armhole < 0.1 && options.s3Armhole > -0.1) {
|
||||
points.s3ArmholeSplit = points.shoulder
|
||||
paths.frontArmhole = new Path()
|
||||
.move(points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
} else if (options.s3Armhole > 0) {
|
||||
// Shift shoulder seam forward on the armhole side
|
||||
points.s3ArmholeSplit = utils.curveIntersectsY(
|
||||
|
@ -85,7 +85,7 @@ export const front = {
|
|||
.move(points.armholePitch)
|
||||
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.split(points.s3ArmholeSplit)[0]
|
||||
.setRender(false)
|
||||
.hide()
|
||||
} else if (options.s3Armhole < 0) {
|
||||
// Shift shoulder seam forward on the armhole side
|
||||
points.s3ArmholeSplit = utils.curveIntersectsY(
|
||||
|
@ -108,7 +108,7 @@ export const front = {
|
|||
)
|
||||
.split(points.s3ArmholeSplit)[0]
|
||||
)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
}
|
||||
|
||||
// Rename cb (center back) to cf (center front)
|
||||
|
@ -130,7 +130,7 @@ export const front = {
|
|||
.line(points.s3CollarSplit)
|
||||
.join(paths.frontCollar)
|
||||
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.seam = new Path()
|
||||
.move(points.cfNeck)
|
||||
.line(points.cfHem)
|
||||
|
|
|
@ -43,7 +43,7 @@ export const sleeve = {
|
|||
points.wristLeft = points.wristRight.rotate(180, points.centerWrist)
|
||||
|
||||
// Paths
|
||||
paths.sleevecap.render = false
|
||||
paths.sleevecap.hide()
|
||||
paths.seam = new Path()
|
||||
.move(points.bicepsLeft)
|
||||
.move(points.wristLeft)
|
||||
|
|
|
@ -130,9 +130,9 @@ function draftBruceFront({
|
|||
.move(points.leftTuskRight)
|
||||
.line(points.leftTuskLeft)
|
||||
.curve(points.curveLeftCpBottom, points.curveLeftCpTop, points.midLeft)
|
||||
paths.seamStart.render = false
|
||||
paths.trimBase.render = false
|
||||
paths.seamEnd.render = false
|
||||
paths.seamStart.hide()
|
||||
paths.trimBase.hide()
|
||||
paths.seamEnd.hide()
|
||||
paths.seam = paths.seamStart.join(paths.trimBase).join(paths.seamEnd)
|
||||
} else {
|
||||
paths.seam = new Path()
|
||||
|
|
|
@ -53,8 +53,8 @@ function draftBruceSide({
|
|||
.line(points.topRight)
|
||||
.line(points.bottomRight)
|
||||
paths.hemBase = new Path().move(points.bottomRight).line(points.bottomLeft)
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.seam = paths.saBase.join(paths.hemBase).close().attr('class', 'fabric')
|
||||
|
||||
// Anchor point for sampling
|
||||
|
|
|
@ -28,7 +28,6 @@ function draftCarltonBelt({
|
|||
via: points.topLeft,
|
||||
prefix: 'roundTop',
|
||||
radius: width / 4,
|
||||
render: true,
|
||||
})
|
||||
macro('round', {
|
||||
from: points.topLeft,
|
||||
|
@ -36,7 +35,6 @@ function draftCarltonBelt({
|
|||
via: points.bottomLeft,
|
||||
prefix: 'roundBottom',
|
||||
radius: width / 4,
|
||||
render: true,
|
||||
})
|
||||
|
||||
// Paths
|
||||
|
|
|
@ -222,8 +222,8 @@ function draftCarltonFront({
|
|||
.line(points.hemEdge)
|
||||
.line(points.flbHem)
|
||||
paths.hemBase = new Path().move(points.flbHem).line(points.hem)
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.seam = paths.saBase.join(paths.hemBase).close().attr('class', 'fabric')
|
||||
|
||||
paths.rollLine = new Path()
|
||||
|
|
|
@ -26,7 +26,6 @@ function draftCarltonTopSleeve({
|
|||
from: points.cuffBottomLeft,
|
||||
via: points.cuffBottomRight,
|
||||
radius: length / 3,
|
||||
render: true,
|
||||
prefix: 'round',
|
||||
})
|
||||
store.set('topCuffWidth', points.tsWristLeft.dist(points.tsWristRight))
|
||||
|
|
|
@ -25,7 +25,6 @@ function draftCarltonUnderSleeve({
|
|||
from: points.cuffBottomLeft,
|
||||
via: points.cuffBottomRight,
|
||||
radius: length / 3,
|
||||
render: true,
|
||||
prefix: 'round',
|
||||
})
|
||||
store.set('underCuffWidth', points.usWristLeft.dist(points.usWristRight))
|
||||
|
|
|
@ -72,8 +72,8 @@ function draftCathrinBase({ measurements, options, store, points, paths, Point,
|
|||
.line(points.bottomSide)
|
||||
.line(points.waistCF)
|
||||
.line(points.waistCB)
|
||||
paths.help1.render = false
|
||||
paths.help2.render = false
|
||||
paths.help1.hide()
|
||||
paths.help2.hide()
|
||||
|
||||
paths.outline = new Path()
|
||||
.move(points.bottomCF)
|
||||
|
|
|
@ -136,7 +136,7 @@ function draftCathrinPanels({ measurements, options, store, points, paths, Point
|
|||
.close()
|
||||
.attr('class', 'fabric')
|
||||
|
||||
paths.outline.render = false
|
||||
paths.outline.hide()
|
||||
|
||||
return part
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ export function draftDianaFrontOrBack({
|
|||
|
||||
paths.hemBase = new Path().move(points.cHem).line(points.hem)
|
||||
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.hemBase.join(paths.saBase).line(points.cHem)
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ function draftDianaSleeve({ sa, points, paths, Path, complete, paperless, macro,
|
|||
.join(paths.sleevecap)
|
||||
.line(points.wristLeft)
|
||||
paths.hemBase = new Path().move(points.wristLeft).line(points.wristRight)
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * 3))
|
||||
paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ export const plugin_bartackalong = {
|
|||
points.e = new Point(20, 10)
|
||||
points.f = new Point(30, 10)
|
||||
|
||||
paths.a = new Path().move(points.a).curve(points.b, points.c, points.d).setRender(false)
|
||||
paths.a = new Path().move(points.a).curve(points.b, points.c, points.d).hide()
|
||||
|
||||
macro('bartackAlong', {
|
||||
path: paths.a,
|
||||
|
@ -70,7 +70,7 @@ export const plugin_bartackfractionalong = {
|
|||
points.e = new Point(20, 10)
|
||||
points.f = new Point(30, 10)
|
||||
|
||||
paths.a = new Path().move(points.a).curve(points.b, points.c, points.d).setRender(false)
|
||||
paths.a = new Path().move(points.a).curve(points.b, points.c, points.d).hide()
|
||||
|
||||
macro('bartackFractionAlong', {
|
||||
path: paths.a,
|
||||
|
@ -187,7 +187,6 @@ export const plugin_gore = {
|
|||
radius: 60,
|
||||
gores: 5,
|
||||
extraLength: 20,
|
||||
render: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
@ -278,7 +277,6 @@ export const plugin_round = {
|
|||
via: points.bottomLeft,
|
||||
radius: 10,
|
||||
prefix: 'bl',
|
||||
render: true,
|
||||
})
|
||||
macro('round', {
|
||||
from: points.bottomRight,
|
||||
|
@ -286,7 +284,6 @@ export const plugin_round = {
|
|||
via: points.topRight,
|
||||
radius: 20,
|
||||
prefix: 'tr',
|
||||
render: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
|
|
@ -29,8 +29,8 @@ function draftFlorentBrimInterfacing({
|
|||
points.insetStart = paths.inset.shiftAlong(5)
|
||||
points.insetEnd = paths.inset.reverse().shiftAlong(5)
|
||||
paths.inset = paths.inset.split(points.insetStart).pop().split(points.insetEnd).shift()
|
||||
paths.inset.render = false
|
||||
paths.outset.render = false
|
||||
paths.inset.hide()
|
||||
paths.outset.hide()
|
||||
|
||||
paths.hint = paths.seam.clone().attr('class', 'dashed stroke-sm')
|
||||
paths.seam = paths.outset
|
||||
|
|
|
@ -19,7 +19,7 @@ function draftFlorentSide({
|
|||
}
|
||||
|
||||
paths.seam = paths.side.clone().line(points.foldTop).attr('class', 'fabric')
|
||||
paths.seam.render = true
|
||||
paths.seam.unhide()
|
||||
|
||||
if (complete) {
|
||||
if (points.__miniscaleMetric) delete points.__miniscaleMetric
|
||||
|
|
|
@ -135,7 +135,7 @@ function draftFlorentTop({
|
|||
.attr('class', 'fabric')
|
||||
|
||||
// Uncomment to see the side part here
|
||||
paths.side.render = false
|
||||
paths.side.hide()
|
||||
|
||||
if (complete) {
|
||||
points.title = new Point(points.midMid.x, points.midFrontCp2.y)
|
||||
|
|
|
@ -27,7 +27,6 @@ function draftHolmesGore({
|
|||
gores: options.gores,
|
||||
extraLength: ((options.lengthRatio - 0.5) * headCircumference) / 2,
|
||||
prefix: 'gore_',
|
||||
render: true,
|
||||
})
|
||||
|
||||
// Complete?
|
||||
|
@ -47,13 +46,13 @@ function draftHolmesGore({
|
|||
.move(points.gore_p1)
|
||||
.curve(points.gore_Cp1, points.gore_Cp2, points.gore_p2)
|
||||
.offset(sa)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
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)
|
||||
.hide()
|
||||
paths.sa = new Path()
|
||||
.move(points.gore_p1)
|
||||
.line(points.gore_p1.shift(0, sa))
|
||||
|
|
|
@ -50,8 +50,8 @@ function draftHueyBack({
|
|||
.join(paths.backCollar)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
paths.hemBase = new Path().move(points.cbHem).line(points.hem).attr('class', 'note stroke-xxl')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase
|
||||
.clone()
|
||||
|
|
|
@ -70,8 +70,8 @@ function draftHueyFront({
|
|||
.line(points.cfHem)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
paths.hemBase = new Path().move(points.cfHem).line(points.hem).attr('class', 'note stroke-xxl')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase.clone().join(paths.hemBase).close().attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ function draftHueySleeve({
|
|||
.move(points.wristLeft)
|
||||
.line(points.wristRight)
|
||||
.attr('class', 'various stroke-xxl')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase.join(paths.hemBase).close().attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ function hugoBack({
|
|||
.line(points.raglanTipBack)
|
||||
.join(neckOpeningParts[0].reverse())
|
||||
paths.seam = paths.saBase.clone().close().attr('class', 'fabric')
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
|
||||
// Store neck opening path
|
||||
store.set('neckOpeningPartBack', neckOpeningParts[1])
|
||||
|
|
|
@ -88,7 +88,7 @@ function hugoFront({
|
|||
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||
.line(points.raglanTipFront)
|
||||
.join(neckOpeningParts[0].reverse())
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.seam = paths.saBase.clone().close().attr('class', 'fabric')
|
||||
// FIXME: This pocket path is not getting set on the paths object
|
||||
// It's something to do with the paths proxy which -- I assume -- is proxying the wrong object?
|
||||
|
@ -98,7 +98,7 @@ function hugoFront({
|
|||
.curve(points.pocketTip, points.pocketTopCp, points.pocketTop)
|
||||
.line(points.pocketCf)
|
||||
.attr('class', 'fabric help')
|
||||
.setRender(false)
|
||||
.hide()
|
||||
// Store shoulder seam length, neck opening path, shoulder slope and raglan length
|
||||
store.set('shoulderLength', points.neck.dist(points.shoulder))
|
||||
store.set('neckOpeningPartFront', neckOpeningParts[1])
|
||||
|
@ -117,7 +117,6 @@ function hugoFront({
|
|||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
//paths.pocket.setRender(true)
|
||||
macro('cutonfold', {
|
||||
from: points.cfNeck,
|
||||
to: points.cfRibbing,
|
||||
|
|
|
@ -24,7 +24,7 @@ function hugoPocket({
|
|||
.line(points.pocketHem)
|
||||
.close()
|
||||
.attr('class', 'fabric', true)
|
||||
paths.seam.render = true
|
||||
paths.seam.unhide()
|
||||
|
||||
paths.saBase = new Path()
|
||||
.move(points.cfRibbing)
|
||||
|
@ -32,7 +32,7 @@ function hugoPocket({
|
|||
.line(points.pocketTip)
|
||||
._curve(points.pocketTopCp, points.pocketTop)
|
||||
.line(points.pocketCf)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
store.set('facingWidth', points.pocketHem.dist(points.pocketTip) / 2)
|
||||
|
||||
|
@ -53,11 +53,11 @@ function hugoPocket({
|
|||
.line(facing.start())
|
||||
.join(facing)
|
||||
.attr('class', ' fabric help')
|
||||
paths.facing.render = false
|
||||
paths.facing.hide()
|
||||
|
||||
// Complete pattern?
|
||||
if (complete) {
|
||||
paths.facing.render = true
|
||||
paths.facing.unhide()
|
||||
macro('cutonfold', {
|
||||
from: points.pocketCf,
|
||||
to: points.cfRibbing,
|
||||
|
|
|
@ -37,7 +37,7 @@ function jaegerBack({
|
|||
.pop()
|
||||
.line(points.cbHem)
|
||||
paths.vent = paths.ventBase.offset(measurements.neck / 10)
|
||||
paths.vent.render = false
|
||||
paths.vent.hide()
|
||||
points.ventSlopeStart = utils.lineIntersectsCurve(
|
||||
paths.vent.start(),
|
||||
paths.vent.start().shift(10, measurements.neck / 5),
|
||||
|
@ -63,7 +63,7 @@ function jaegerBack({
|
|||
.pop()
|
||||
.line(points.hem)
|
||||
paths.vent = paths.ventBase.offset(measurements.neck / -10)
|
||||
paths.vent.render = false
|
||||
paths.vent.hide()
|
||||
points.ventSlopeStart = utils.lineIntersectsCurve(
|
||||
paths.vent.start(),
|
||||
paths.vent.start().shift(170, measurements.neck / 5),
|
||||
|
@ -94,7 +94,7 @@ function jaegerBack({
|
|||
.split(points.ventSlopeStart)
|
||||
.pop()
|
||||
)
|
||||
paths.saBase.render = true
|
||||
paths.saBase.unhide()
|
||||
} else {
|
||||
paths.saBase = new Path()
|
||||
.move(points.hem)
|
||||
|
@ -126,13 +126,13 @@ function jaegerBack({
|
|||
} else {
|
||||
paths.saBase.curve(points.cbWaistCp2, points.cbHipsCp1, points.cbHips).line(points.cbHem)
|
||||
}
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
|
||||
if (options.backVent === 2) paths.hemBase = new Path().move(points.cbHem).line(paths.vent.end())
|
||||
else if (options.backVent === 1)
|
||||
paths.hemBase = new Path().move(paths.vent.end()).line(points.hem)
|
||||
else paths.hemBase = new Path().move(points.cbHem).line(points.hem)
|
||||
paths.hemBase.render = false
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase.join(paths.hemBase).attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -334,10 +334,10 @@ function jaegerFront({
|
|||
.line(points.cutawayPoint)
|
||||
.curve(points.cutawayPointCp2, points.roundStartCp1, points.roundStart)
|
||||
.curve(points.roundCp1, points.roundCp2, points.roundEnd)
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
|
||||
paths.hemBase = new Path().move(points.roundEnd).line(points.hem)
|
||||
paths.hemBase.render = false
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase.clone().join(paths.hemBase).attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ function jaegerSide({
|
|||
.pop()
|
||||
.line(points.bsHem)
|
||||
paths.vent = paths.ventBase.offset(measurements.neck / -10)
|
||||
//paths.vent.render = false;
|
||||
points.ventSlopeStart = utils.lineIntersectsCurve(
|
||||
paths.vent.start(),
|
||||
paths.vent.start().shift(170, measurements.neck / 5),
|
||||
|
|
|
@ -58,8 +58,8 @@ function jaegerUnderCollar({
|
|||
.line(paths.sa1.end())
|
||||
.line(points.collarCbTop)
|
||||
.attr('class', 'various sa')
|
||||
paths.sa1.render = false
|
||||
paths.sa2.render = false
|
||||
paths.sa1.hide()
|
||||
paths.sa2.hide()
|
||||
}
|
||||
|
||||
if (paperless) {
|
||||
|
|
|
@ -14,10 +14,10 @@ function nobleBackInside({
|
|||
part,
|
||||
}) {
|
||||
if (options.dartPosition != 'shoulder') {
|
||||
paths.insideSeam = paths.seam.clone().setRender(true)
|
||||
paths.insideSeam = paths.seam.clone().unhide()
|
||||
} else {
|
||||
// Hide Bella paths
|
||||
for (let key of Object.keys(paths)) paths[key].render = false
|
||||
for (let key of Object.keys(paths)) paths[key].hide()
|
||||
for (let i in snippets) delete snippets[i]
|
||||
|
||||
paths.insideSeam = new Path()
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as options from './options.mjs'
|
|||
|
||||
function nobleBackPoints({ points, Path, paths, options, snippets, log, part }) {
|
||||
// Hide Bella paths
|
||||
for (let key of Object.keys(paths)) paths[key].render = false
|
||||
for (let key of Object.keys(paths)) paths[key].hide()
|
||||
for (let i in snippets) delete snippets[i]
|
||||
|
||||
delete points.__titleNr
|
||||
|
|
|
@ -5,7 +5,7 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
const bCircle = 0.552284749831
|
||||
|
||||
// Hide Bella paths
|
||||
for (let key of Object.keys(paths)) paths[key].render = false
|
||||
for (let key of Object.keys(paths)) paths[key].hide()
|
||||
for (let i in snippets) delete snippets[i]
|
||||
|
||||
// Remove macros from Bella
|
||||
|
@ -30,11 +30,10 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
points.armholeDartInside = armholePath.shiftFractionAlong(options.armholeDartPosition)
|
||||
points.armholeDartOutside = points.armholeDartInside.clone()
|
||||
|
||||
// paths.armholeTemp = armholePath.clone().setRender(true).attr('class', 'lining')
|
||||
let armholePaths = armholePath.split(points.armholeDartInside)
|
||||
|
||||
let armholePathInside = armholePaths[0].clone().setRender(false)
|
||||
let armholePathOutside = armholePaths[1].clone().setRender(false)
|
||||
let armholePathInside = armholePaths[0].clone().hide()
|
||||
let armholePathOutside = armholePaths[1].clone().hide()
|
||||
let armholeDartAngle =
|
||||
armholePathInside.reverse().shiftAlong(1).angle(armholePathOutside.shiftAlong(1)) - 90
|
||||
|
||||
|
@ -78,13 +77,13 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
paths.armholeInside = new Path()
|
||||
.move(points.armholeDartInside)
|
||||
.curve(points.armholeInsidePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
} else {
|
||||
paths.armholeInside = new Path()
|
||||
.move(points.armholeDartInside)
|
||||
.curve(points.armholeDartInsideCp2, points.armholeInsidePitchCp1, points.armholeInsidePitch)
|
||||
.curve(points.armholeInsidePitchCp2, points.shoulderCp1, points.shoulder)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
}
|
||||
|
||||
let rotateAngle =
|
||||
|
@ -145,7 +144,7 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
paths.armholeOutside = new Path()
|
||||
.move(points.armholeDartOutside)
|
||||
.curve(points.armholeDartOutsideCp1, points.armholeOutsidePitchCp2, points.armhole)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
} else {
|
||||
paths.armholeOutside = new Path()
|
||||
.move(points.armholeDartOutside)
|
||||
|
@ -155,14 +154,14 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
points.armholeOutsidePitch
|
||||
)
|
||||
.curve(points.armholeOutsidePitchCp1, points.armholeCp2, points.armhole)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
}
|
||||
|
||||
paths.armholeTempDart = new Path()
|
||||
.move(points.armholeDartOutside)
|
||||
._curve(points.armholeDartCpBottom, points.armholeDartTip)
|
||||
.curve_(points.armholeDartCpTop, points.armholeDartInside)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
points.shoulderDartTipCpDownOutside = points.shoulderDartOutside.shiftFractionTowards(
|
||||
points.bust,
|
||||
|
@ -186,17 +185,17 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
.move(points.waistDartLeft)
|
||||
.curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip)
|
||||
.line(points.shoulderDartInside)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
paths.armholeInsideSeam = new Path()
|
||||
.move(points.waistDartLeft)
|
||||
.curve(points.waistDartLeftCp, points.armholeDartTipCpDownInside, points.armholeDartTip)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
paths.sOutsideSeam = new Path()
|
||||
.move(points.waistDartRight)
|
||||
.curve(points.bustAcp, points.shoulderDartTipCpDownOutside, points.shoulderDartOutside)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
points.waistDartRightCp = points.bustAcp.clone()
|
||||
|
||||
|
@ -204,7 +203,7 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
.move(points.waistDartLeft)
|
||||
.curve(points.waistDartLeftCp, points.shoulderDartTipCpDownInside, points.shoulderDartTip)
|
||||
.line(points.shoulderDartInside)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
points.waistUpDartLeft = paths.armholeInsideSeam.shiftAlong(
|
||||
points.waistDartLeft.dist(points.armholeDartTip) * 0.5
|
||||
|
@ -293,7 +292,7 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
.move(points.armholeDartOutside)
|
||||
.curve(points.armholeCircleOutsideCp1, points.waistCircleOutsideCp1, points.waistUpDartRight)
|
||||
.curve(points.waistUpDartRightCpDown, points.waistCpUp, points.waistDartRight)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
.attr('class', 'lining')
|
||||
paths.armholeTempCircleInside = new Path()
|
||||
.move(points.armholeDartInside)
|
||||
|
@ -303,7 +302,7 @@ function nobleFrontPoints({ log, points, Path, paths, snippets, options, macro,
|
|||
points.armholeDartTipInside
|
||||
)
|
||||
.curve(points.armholeDartTipCpDownInside, points.waistDartLeftCp, points.waistDartLeft)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
.attr('class', 'lining')
|
||||
|
||||
diff = paths.armholeTempCircleOutside.length() - paths.armholeTempCircleInside.length()
|
||||
|
|
|
@ -13,10 +13,7 @@ function pacoBackPocketBag({
|
|||
part,
|
||||
}) {
|
||||
// Don't bother of we're not drafting back pockets
|
||||
if (!options.backPockets) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.backPockets) return part.hide()
|
||||
|
||||
// Clean up
|
||||
for (const path in paths) delete paths[path]
|
||||
|
|
|
@ -14,10 +14,7 @@ function pacoBackPocketWelt({
|
|||
part,
|
||||
}) {
|
||||
// Don't bother of we're not drafting back pockets
|
||||
if (!options.backPockets) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.backPockets) return part.hide()
|
||||
|
||||
// Clean up
|
||||
for (const path in paths) delete paths[path]
|
||||
|
|
|
@ -12,10 +12,7 @@ function pacoBackPocketWeltInterfacing({
|
|||
part,
|
||||
}) {
|
||||
// Don't bother of we're not drafting back pockets
|
||||
if (!options.backPockets) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.backPockets) return part.hide()
|
||||
|
||||
// Clean up
|
||||
for (const path in paths) delete paths[path]
|
||||
|
|
|
@ -13,10 +13,7 @@ function pacoCuff({
|
|||
macro,
|
||||
part,
|
||||
}) {
|
||||
if (!options.elasticatedHem) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.elasticatedHem) return part.hide()
|
||||
|
||||
let len = store.get('frontAnkle') + store.get('backAnkle')
|
||||
points.topLeft = new Point(0, 0)
|
||||
|
|
|
@ -13,10 +13,7 @@ function pacoFrontPocketBag({
|
|||
part,
|
||||
}) {
|
||||
// Don't bother of we're not drafting front pockets
|
||||
if (!options.frontPockets) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.frontPockets) return part.hide()
|
||||
|
||||
// Clean up
|
||||
for (const path in paths) delete paths[path]
|
||||
|
|
|
@ -17,10 +17,7 @@ function penelopeWaistband({
|
|||
store,
|
||||
part,
|
||||
}) {
|
||||
if (!options.waistBand) {
|
||||
part.render = false
|
||||
return part
|
||||
}
|
||||
if (!options.waistBand) return part.hide()
|
||||
|
||||
let waist = measurements.waist
|
||||
waist += measurements.waist * options.waistEase
|
||||
|
|
|
@ -9,7 +9,6 @@ const pluginGore = ({ points, Point, options, macro, part }) => {
|
|||
radius: options.goreRadius,
|
||||
gores: options.goreGoreNumber,
|
||||
extraLength: options.goreExtraLength,
|
||||
render: true,
|
||||
})
|
||||
}
|
||||
return part
|
||||
|
|
|
@ -18,7 +18,7 @@ const pluginRound = ({ Point, points, Path, paths, macro, options, part }) => {
|
|||
|
||||
const opts = {
|
||||
radius: options.roundRadius,
|
||||
render: options.roundRender,
|
||||
hide: options.roundHide,
|
||||
}
|
||||
|
||||
macro('round', {
|
||||
|
@ -45,7 +45,7 @@ export const round = {
|
|||
after: base,
|
||||
options: {
|
||||
roundRadius: { count: 10, min: 0, max: 50, menu: 'round' },
|
||||
roundRender: { bool: true, menu: 'round' },
|
||||
roundHide: { bool: false, menu: 'round' },
|
||||
},
|
||||
plugins: roundPlugin,
|
||||
draft: pluginRound,
|
||||
|
|
|
@ -141,8 +141,8 @@ function sandySkirt({
|
|||
if (!options.seamlessFullCircle) paths.saBase = paths.saBase.line(points.ex1Rotated)
|
||||
paths.saBase = paths.saBase.offset(sa * -1)
|
||||
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.hide()
|
||||
paths.saBase.hide()
|
||||
|
||||
if (options.seamlessFullCircle) {
|
||||
paths.sa = new Path()
|
||||
|
|
|
@ -98,8 +98,8 @@ function shinBack({
|
|||
.join(paths.saBase)
|
||||
|
||||
paths.hemBase = new Path().move(points.legSide).curve_(points.legSideCp, points.reducedLegInner)
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase.join(paths.hemBase).attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -99,8 +99,8 @@ function shinFront({
|
|||
.join(paths.saBase)
|
||||
paths.hemBase = new Path().move(points.legSide).curve_(points.legSideCp, points.reducedLegInner)
|
||||
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.saBase.join(paths.hemBase).attr('class', 'fabric')
|
||||
|
||||
|
|
|
@ -131,11 +131,11 @@ function simonBack({
|
|||
}
|
||||
|
||||
const [back, yoke] = paths.backArmhole.split(points.armholeYokeSplit)
|
||||
paths.backArmholeYoke = yoke.setRender(false)
|
||||
paths.backArmholeYoke = yoke.hide()
|
||||
// For 1/10 dolls with breasts, this path becomes non-existing so we put a dummy here
|
||||
paths.backArmholeBack = back.attributes
|
||||
? back.setRender(false)
|
||||
: new Path().move(points.armholeYokeSplit).line(points.armholeYokeSplit).setRender(false)
|
||||
? back.hide()
|
||||
: new Path().move(points.armholeYokeSplit).line(points.armholeYokeSplit).hide()
|
||||
|
||||
// We'll re-use this
|
||||
const armholeToPitch = new Path()
|
||||
|
@ -151,7 +151,7 @@ function simonBack({
|
|||
paths.armhole = armholeToPitch
|
||||
if (options.yokeHeight === 0) paths.armhole = paths.armhole.join(paths.backArmhole)
|
||||
else paths.armhole = paths.armhole.join(paths.backArmholeBack)
|
||||
paths.armhole.render = false
|
||||
paths.armhole.hide()
|
||||
|
||||
if (options.roundBack > 0) {
|
||||
points.cbTop = points.cbYoke.shift(90, points.armholePitch.x * options.roundBack)
|
||||
|
@ -170,7 +170,7 @@ function simonBack({
|
|||
points.boxPleatLeftBottom = new Point(points.boxPleatLeft.x, points.armholeHollowCp2.y)
|
||||
points.boxPleatMidBottom = new Point(points.boxPleatMid.x, points.armholeHollowCp2.y)
|
||||
points.boxPleatRightBottom = new Point(points.boxPleatRight.x, points.armholeHollowCp2.y)
|
||||
paths.armhole.setRender(false)
|
||||
paths.armhole.hide()
|
||||
paths.armhole = paths.armhole.translate(store.get('boxPleatFold') * 2, 0)
|
||||
for (const p of [
|
||||
'armholePitch',
|
||||
|
@ -235,8 +235,8 @@ function simonBack({
|
|||
else paths.saBase = paths.saBase.line(points.cbYoke)
|
||||
|
||||
// Paths
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.seam = paths.hemBase.join(paths.saBase).close().attr('class', 'fabric')
|
||||
|
||||
// Complete pattern?
|
||||
|
|
|
@ -110,10 +110,10 @@ function simonFront({
|
|||
}
|
||||
|
||||
// Paths
|
||||
paths.saBase.render = false
|
||||
paths.saBaseFromHips.render = false
|
||||
paths.saBaseFromArmhole.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.saBaseFromHips.hide()
|
||||
paths.saBaseFromArmhole.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.seam = paths.hemBase
|
||||
.join(paths.saBase)
|
||||
.join(paths.saBaseFromArmhole)
|
||||
|
|
|
@ -43,7 +43,7 @@ function simonSleeve({
|
|||
.curve(points.capQ2Cp2, points.capQ3Cp1, points.capQ3)
|
||||
.curve(points.capQ3Cp2, points.capQ4Cp1, points.capQ4)
|
||||
.curve_(points.capQ4Cp2, points.bicepsLeft)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
points.top = new Point(0, paths.sleevecap.edge('top').y)
|
||||
points.bottom = points.top.shift(-90, len)
|
||||
|
||||
|
@ -114,10 +114,10 @@ function simonSleeve({
|
|||
.curve(points.capQ2Cp2, points.capQ3Cp1, points.capQ3)
|
||||
.curve(points.capQ3Cp2, points.capQ4Cp1, points.capQ4)
|
||||
.curve_(points.capQ4Cp2, points.bicepsLeft)
|
||||
paths.frenchBase.render = false
|
||||
paths.frenchBase.hide()
|
||||
|
||||
paths.saBase = new Path().move(points.bicepsLeft).line(points.wristLeft)
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
|
||||
paths.cuffBase = new Path()
|
||||
.move(points.wristLeft)
|
||||
|
@ -128,7 +128,7 @@ function simonSleeve({
|
|||
paths.cuffBase._curve(points.cuffRightCuspCp1, points.cuffRightCusp)
|
||||
if (pleats === 2) paths.cuffBase.line(points.cuffPleat2Edge)
|
||||
paths.cuffBase.curve_(points.cuffRightCuspCp2, points.wristRight)
|
||||
paths.cuffBase.render = false
|
||||
paths.cuffBase.hide()
|
||||
|
||||
paths.seam = paths.frenchBase
|
||||
.clone()
|
||||
|
|
|
@ -31,10 +31,10 @@ function simonYoke({
|
|||
clone: true,
|
||||
})
|
||||
paths.saBase = paths.saBase.join(paths.mirroredSaBase.reverse())
|
||||
paths.mirroredSaBase.setRender(false)
|
||||
paths.mirroredSaBase.hide()
|
||||
}
|
||||
paths.seam = paths.saBase.clone()
|
||||
paths.saBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.seam = paths.seam.close().attr('class', 'fabric')
|
||||
|
||||
// Complete pattern?
|
||||
|
|
|
@ -166,8 +166,8 @@ function simoneFbaFront({
|
|||
.split(points.bustSideCut1_rot1)
|
||||
paths.fbaAboveDart = toSplit.pop()
|
||||
paths.fbaBelowDart = toSplit.pop()
|
||||
paths.fbaAboveDart.render = false
|
||||
paths.fbaBelowDart.render = false
|
||||
paths.fbaAboveDart.hide()
|
||||
paths.fbaBelowDart.hide()
|
||||
points.belowDartCpTop_rot1 = paths.fbaBelowDart.ops[1].cp2
|
||||
points.belowDartCpBottom_rot1 = paths.fbaBelowDart.ops[1].cp1
|
||||
points.aboveDartCpBottom_rot1 = paths.fbaAboveDart.ops[1].cp1 // (only one CP on this part
|
||||
|
@ -392,9 +392,9 @@ function simoneFbaFront({
|
|||
.join(paths.saBaseFromArmhole)
|
||||
.attr('class', 'fabric')
|
||||
|
||||
paths.saBaseFromHips.render = false
|
||||
paths.saBaseFromArmhole.render = false
|
||||
paths.saBase.render = false
|
||||
paths.saBaseFromHips.hide()
|
||||
paths.saBaseFromArmhole.hide()
|
||||
paths.saBase.hide()
|
||||
|
||||
if (complete && sa) {
|
||||
paths.saFrench = paths.saBase.offset(sa * options.ffsa).attr('class', 'fabric sa')
|
||||
|
|
|
@ -45,8 +45,8 @@ function svenFrontBack({
|
|||
if (front) paths.hemBase = new Path().move(points.cfHem).line(points.hem)
|
||||
else paths.hemBase = new Path().move(points.cbHem).line(points.hem)
|
||||
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
|
||||
paths.seam = paths.hemBase.join(paths.saBase)
|
||||
if (front) paths.seam.line(points.cfHem)
|
||||
|
|
|
@ -31,8 +31,8 @@ function svenSleeve({ store, sa, points, paths, Path, complete, paperless, macro
|
|||
.join(paths.sleevecap)
|
||||
.line(points.wristLeft)
|
||||
paths.hemBase = new Path().move(points.wristLeft).line(points.wristRight)
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.sa = paths.saBase.offset(sa).join(paths.hemBase.offset(sa * (options.ribbing ? 1 : 3)))
|
||||
paths.sa.line(paths.sa.start()).close().attr('class', 'fabric sa')
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ function teaganFront({
|
|||
part,
|
||||
}) {
|
||||
// Hide Brian paths
|
||||
for (let key of Object.keys(paths)) paths[key].render = false
|
||||
for (let key of Object.keys(paths)) paths[key].hide()
|
||||
|
||||
// Adapt fit to waist
|
||||
let width
|
||||
|
@ -61,7 +61,7 @@ function teaganFront({
|
|||
log.info(['fullLengthFromHps', units(points.hps.dy(points.hem))])
|
||||
|
||||
// Draw seamline
|
||||
paths.hemBase = new Path().move(points.cfHem).line(points.hem).setRender(false)
|
||||
paths.hemBase = new Path().move(points.cfHem).line(points.hem).hide()
|
||||
paths.saBase = new Path()
|
||||
.move(points.hem)
|
||||
.curve_(points.waistCp2, points.armhole)
|
||||
|
@ -69,7 +69,7 @@ function teaganFront({
|
|||
.curve(points.armholeHollowCp2, points.shoulderCp1, points.shoulder)
|
||||
.line(points.neck)
|
||||
.curve(points.neckCp2, points.cfNeckCp1, points.cfNeck)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
paths.seam = new Path()
|
||||
.move(points.cfHem)
|
||||
.join(paths.hemBase)
|
||||
|
|
|
@ -403,8 +403,8 @@ function titanBack({
|
|||
.join(paths.saBase.offset(sa))
|
||||
.close()
|
||||
.attr('class', 'fabric sa')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
}
|
||||
|
||||
if (paperless && options.titanPaperless) {
|
||||
|
|
|
@ -477,8 +477,8 @@ function titanFront({
|
|||
.join(paths.saBase.offset(sa))
|
||||
.close()
|
||||
.attr('class', 'fabric sa')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
}
|
||||
|
||||
if (paperless && options.titanPaperless) {
|
||||
|
|
|
@ -65,14 +65,12 @@ export const step7 = {
|
|||
to: points.tipRight,
|
||||
via: points.tipRightTop,
|
||||
prefix: 'tipRightTop',
|
||||
render: true,
|
||||
})
|
||||
macro('round', {
|
||||
from: points.tipRight,
|
||||
to: points.top,
|
||||
via: points.tipRightBottom,
|
||||
prefix: 'tipRightBottom',
|
||||
render: true,
|
||||
})
|
||||
|
||||
return part
|
||||
|
@ -111,14 +109,12 @@ export const step8 = {
|
|||
to: points.tipRight,
|
||||
via: points.tipRightTop,
|
||||
prefix: 'tipRightTop',
|
||||
render: true,
|
||||
})
|
||||
macro('round', {
|
||||
from: points.tipRight,
|
||||
to: points.top,
|
||||
via: points.tipRightBottom,
|
||||
prefix: 'tipRightBottom',
|
||||
render: true,
|
||||
})
|
||||
|
||||
paths.rect = new Path()
|
||||
|
|
|
@ -50,7 +50,6 @@ export const step10 = {
|
|||
to: points.bottomRight,
|
||||
via: points.bottomLeft,
|
||||
radius: points.bottomRight.x / 4,
|
||||
render: true,
|
||||
prefix: 'bottomLeft',
|
||||
})
|
||||
macro('round', {
|
||||
|
@ -58,7 +57,6 @@ export const step10 = {
|
|||
to: points.topRight,
|
||||
via: points.bottomRight,
|
||||
radius: points.bottomRight.x / 4,
|
||||
render: true,
|
||||
prefix: 'bottomRight',
|
||||
})
|
||||
|
||||
|
|
|
@ -102,10 +102,10 @@ function wahidBack({
|
|||
.join(paths.dart)
|
||||
.line(points.hem)
|
||||
.attr('class', 'fabric')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.dart.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.dart.hide()
|
||||
|
||||
if (complete) {
|
||||
//Grainline
|
||||
|
|
|
@ -252,9 +252,9 @@ function wahidFront({
|
|||
}
|
||||
paths.dart = dartPath(part)
|
||||
paths.seam = paths.saBase.join(paths.dart).join(paths.hemBase).close().attr('class', 'fabric')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.dart.render = false
|
||||
paths.saBase.hide()
|
||||
paths.hemBase.hide()
|
||||
paths.dart.hide()
|
||||
if (complete) {
|
||||
// Pocket path
|
||||
paths.pocket = new Path()
|
||||
|
|
|
@ -24,7 +24,7 @@ function wahidPocketbag({
|
|||
to: points.bottomRight,
|
||||
via: points.bottomLeft,
|
||||
radius: pw / 8,
|
||||
render: false,
|
||||
hidden: true,
|
||||
prefix: 'roundLeft',
|
||||
})
|
||||
macro('round', {
|
||||
|
@ -32,7 +32,7 @@ function wahidPocketbag({
|
|||
to: points.topRight,
|
||||
via: points.bottomRight,
|
||||
radius: pw / 8,
|
||||
render: false,
|
||||
hidden: true,
|
||||
prefix: 'roundRight',
|
||||
})
|
||||
paths.seam = new Path()
|
||||
|
|
|
@ -27,7 +27,7 @@ function wahidPocketFacing({
|
|||
to: points.bottomRight,
|
||||
via: points.bottomLeft,
|
||||
radius: pw / 8,
|
||||
render: false,
|
||||
hidden: true,
|
||||
prefix: 'roundLeft',
|
||||
})
|
||||
macro('round', {
|
||||
|
@ -35,7 +35,7 @@ function wahidPocketFacing({
|
|||
to: points.topRight,
|
||||
via: points.bottomRight,
|
||||
radius: pw / 8,
|
||||
render: false,
|
||||
hidden: true,
|
||||
prefix: 'roundRight',
|
||||
})
|
||||
paths.seam = new Path()
|
||||
|
|
|
@ -29,7 +29,7 @@ function waraleeCutout({
|
|||
.close()
|
||||
.attr('class', 'fabric')
|
||||
|
||||
paths.cutout.setRender(false)
|
||||
paths.cutout.hide()
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
|
@ -79,9 +79,8 @@ function waraleeCutout({
|
|||
x: points.mWaist.x + 15,
|
||||
})
|
||||
}
|
||||
part.render = options.showMini
|
||||
|
||||
return part
|
||||
return part.setHidden(!options.showMini)
|
||||
}
|
||||
|
||||
export const cutout = {
|
||||
|
|
|
@ -38,17 +38,17 @@ function waraleeMini({ options, Path, points, paths, complete, sa, macro, store,
|
|||
.line(separateWaistband ? points.fWaistSideSeam : points.fWaistSide)
|
||||
.attr('class', 'help')
|
||||
|
||||
paths.seam.setRender(true)
|
||||
paths.seam.unhide()
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
macro('scalebox', { at: points.mLeg.shift(-90, 35) })
|
||||
|
||||
if (options.frontPocket && 'welt' == options.frontPocketStyle) {
|
||||
paths.frontPocket.setRender(true)
|
||||
paths.frontPocket.unhide()
|
||||
}
|
||||
if (options.backPocket) {
|
||||
paths.backPocket.setRender(true)
|
||||
paths.backPocket.unhide()
|
||||
}
|
||||
|
||||
if (sa) {
|
||||
|
@ -151,9 +151,7 @@ function waraleeMini({ options, Path, points, paths, complete, sa, macro, store,
|
|||
}
|
||||
}
|
||||
|
||||
part.render = options.showMini
|
||||
|
||||
return part
|
||||
return part.setHidden(!options.showMini)
|
||||
}
|
||||
|
||||
export const mini = {
|
||||
|
|
|
@ -35,7 +35,7 @@ function waraleePants({
|
|||
paths.legFold = paths.leg.offset(-1 * store.get('hem')).attr('class', 'fabric stroke-sm')
|
||||
paths.backFold = paths.back.offset(-1 * store.get('hem')).attr('class', 'fabric stroke-sm')
|
||||
|
||||
paths.seam.setRender(true)
|
||||
paths.seam.unhide()
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
|
@ -56,10 +56,10 @@ function waraleePants({
|
|||
}
|
||||
|
||||
if (options.frontPocket && 'welt' == options.frontPocketStyle) {
|
||||
paths.frontPocket.setRender(true)
|
||||
paths.frontPocket.unhide()
|
||||
}
|
||||
if (options.backPocket) {
|
||||
paths.backPocket.setRender(true)
|
||||
paths.backPocket.unhide()
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
|
@ -161,9 +161,7 @@ function waraleePants({
|
|||
}
|
||||
}
|
||||
|
||||
part.render = options.showMini == false
|
||||
|
||||
return part
|
||||
return part.setHidden(options.showMini != false)
|
||||
}
|
||||
|
||||
export const pants = {
|
||||
|
|
|
@ -122,10 +122,10 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
.curve(points.bWaistCrotchCP, points.bHipCrotchCP, points.mHip)
|
||||
.split(points.bCutOutHip)
|
||||
|
||||
fPaths[0].setRender(false)
|
||||
fPaths[1].setRender(false)
|
||||
bPaths[0].setRender(false)
|
||||
bPaths[1].setRender(false)
|
||||
fPaths[0].hide()
|
||||
fPaths[1].hide()
|
||||
bPaths[0].hide()
|
||||
bPaths[1].hide()
|
||||
|
||||
points.fCutOutHipCp1 = fPaths[1].ops[1].cp1.shiftFractionTowards(points.fCutOutHip, 1.25)
|
||||
points.fCutOutHipCp2 = fPaths[1].ops[1].cp1.clone()
|
||||
|
@ -137,20 +137,20 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
paths.frontBottomCutOut = new Path()
|
||||
.move(points.mHip)
|
||||
.curve(points.mHipCp1, points.fCutOutHipCp2, points.fCutOutHip)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
paths.backBottomCutOut = new Path()
|
||||
.move(points.bCutOutHip)
|
||||
.curve(points.bCutOutHipCp1, points.mHipCp2, points.mHip)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
paths.frontTopCutOut = new Path()
|
||||
.move(points.fCutOutHip)
|
||||
.curve(points.fCutOutHipCp1, points.fWaistAdjusted, points.fWaistAdjusted)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
paths.backTopCutOut = new Path()
|
||||
.move(points.bWaistAdjusted)
|
||||
.curve(points.bWaistAdjusted, points.bCutOutHipCp2, points.bCutOutHip)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
points.fWaistSideHem = paths.frontTopCutOut.reverse().shiftAlong(waistBand)
|
||||
points.fWaistSideSeam = paths.frontTopCutOut.reverse().shiftAlong(waistBand * 2)
|
||||
|
@ -187,7 +187,7 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
paths.frontTopCutOut = new Path()
|
||||
.move(points.fCutOutHip)
|
||||
.curve(points.fCutOutHipCp1, points.fWaistSideCp2, points.fWaistSideSeam)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
if (false == separateWaistband) {
|
||||
paths.frontTopCutOut.line(points.fWaistSideHem)
|
||||
paths.frontTopCutOut.line(points.fWaistSide)
|
||||
|
@ -200,37 +200,35 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
} else {
|
||||
paths.backTopCutOut = new Path().move(points.bWaistSideSeam)
|
||||
}
|
||||
paths.backTopCutOut
|
||||
.curve(points.bWaistSideCp1, points.bCutOutHipCp2, points.bCutOutHip)
|
||||
.setRender(false)
|
||||
paths.backTopCutOut.curve(points.bWaistSideCp1, points.bCutOutHipCp2, points.bCutOutHip).hide()
|
||||
|
||||
paths.cutout = paths.backTopCutOut
|
||||
.join(paths.backBottomCutOut)
|
||||
.join(paths.frontBottomCutOut)
|
||||
.join(paths.frontTopCutOut)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
paths.waistBack = new Path()
|
||||
.move(separateWaistband ? points.bWaistBackOverlapSeam : points.bWaistBackOverlap)
|
||||
.line(separateWaistband ? points.bWaistBackSeam : points.bWaistBack)
|
||||
// .line(points.bWaistSideTemp) // This is a trick to make the offset() call work. Without it, the offset is crossing the cutout line.
|
||||
.line(separateWaistband ? points.bWaistSideSeam : points.bWaistSide)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
paths.waistFront = new Path()
|
||||
.move(separateWaistband ? points.fWaistSideSeam : points.fWaistSide)
|
||||
.line(separateWaistband ? points.fWaistFrontOverlapSeam : points.fWaistFrontOverlap)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
paths.front = new Path()
|
||||
.move(separateWaistband ? points.fWaistFrontOverlapSeam : points.fWaistFrontOverlap)
|
||||
.line(points.fHipFrontOverlap)
|
||||
.line(points.fLegFrontOverlap)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
paths.back = new Path()
|
||||
.move(points.bLegBackOverlap)
|
||||
.line(points.bHipBackOverlap)
|
||||
.line(separateWaistband ? points.bWaistBackOverlapSeam : points.bWaistBackOverlap)
|
||||
.setRender(false)
|
||||
paths.leg = new Path().move(points.fLegFrontOverlap).line(points.bLegBackOverlap).setRender(false)
|
||||
.hide()
|
||||
paths.leg = new Path().move(points.fLegFrontOverlap).line(points.bLegBackOverlap).hide()
|
||||
|
||||
paths.seam = paths.waistFront
|
||||
.join(paths.front)
|
||||
|
@ -240,7 +238,7 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
.join(paths.cutout)
|
||||
.close()
|
||||
.attr('class', 'fabric')
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
if (options.frontPocket) {
|
||||
points.frontPocketTop = points.fWaistSideSeam
|
||||
|
@ -266,7 +264,7 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
.line(points.frontPocketTop2)
|
||||
.close()
|
||||
.attr('class', 'fabric')
|
||||
.setRender(false)
|
||||
.hide()
|
||||
}
|
||||
|
||||
if (options.backPocket) {
|
||||
|
@ -304,12 +302,10 @@ function waraleePantsProto({ options, measurements, Point, Path, points, paths,
|
|||
.line(points.backPocketRight)
|
||||
.close()
|
||||
.attr('class', 'fabric')
|
||||
.setRender(false)
|
||||
.hide()
|
||||
}
|
||||
|
||||
part.render = false
|
||||
|
||||
return part
|
||||
return part.hide()
|
||||
}
|
||||
|
||||
export const pantsProto = {
|
||||
|
|
|
@ -42,7 +42,8 @@ function yuriBack({
|
|||
paths.gussetBase = new Path()
|
||||
.move(points.bottom)
|
||||
.line(points.armhole)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
.setClass('note stroke-xxl')
|
||||
.hide()
|
||||
store.set('gussetLength', paths.gussetBase.length())
|
||||
paths.saBase = new Path()
|
||||
.move(points.armhole)
|
||||
|
@ -51,14 +52,13 @@ function yuriBack({
|
|||
.join(paths.backArmhole)
|
||||
.line(points.s3CollarSplit)
|
||||
.join(paths.backCollar)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
.setClass('note stroke-xxl')
|
||||
.hide()
|
||||
paths.hemBase = new Path()
|
||||
.move(points.cbBottom)
|
||||
.line(points.bottom)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
paths.gussetBase.render = false
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
.setClass('note stroke-xxl')
|
||||
.hide()
|
||||
|
||||
paths.seam = paths.gussetBase
|
||||
.join(paths.saBase)
|
||||
|
|
|
@ -55,19 +55,19 @@ function yuriFront({
|
|||
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
|
||||
.join(paths.frontArmhole)
|
||||
.line(points.s3CollarSplit)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
.setClass('note stroke-xxl')
|
||||
.hide()
|
||||
paths.buttonBase = new Path()
|
||||
.move(points.s3CollarSplit)
|
||||
.line(points.button)
|
||||
.line(points.cfBottom)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
.attr('note stroke-xxl')
|
||||
.hide()
|
||||
paths.hemBase = new Path()
|
||||
.move(points.cfBottom)
|
||||
.line(points.bottom)
|
||||
.attr('class', 'note stroke-xxl')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
paths.buttonBase.render = false
|
||||
.setClass('note stroke-xxl')
|
||||
.hide()
|
||||
|
||||
paths.seam = paths.saBase
|
||||
.clone()
|
||||
|
|
|
@ -12,15 +12,15 @@ function yuriSleeve({ Point, Path, points, paths, complete, sa, paperless, macro
|
|||
.line(points.bicepsRight)
|
||||
.join(paths.sleevecap)
|
||||
.line(points.wristLeft)
|
||||
.attr('class', 'various stroke-xxl')
|
||||
.setClass('various stroke-xxl')
|
||||
.hide()
|
||||
paths.hemBase = new Path()
|
||||
.move(points.wristLeft)
|
||||
.line(points.wristRight)
|
||||
.attr('class', 'various stroke-xxl')
|
||||
paths.saBase.render = false
|
||||
paths.hemBase.render = false
|
||||
.setClass('various stroke-xxl')
|
||||
.hide()
|
||||
|
||||
paths.seam = paths.saBase.join(paths.hemBase).close().attr('class', 'fabric')
|
||||
paths.seam = paths.saBase.join(paths.hemBase).close().setClass('fabric')
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
|
|
|
@ -30,8 +30,7 @@ export function Part() {
|
|||
utils.__addNonEnumProp(this, 'hooks', new Hooks())
|
||||
|
||||
// Enumerable properties
|
||||
this.render = true // FIXME: Replace render with hide
|
||||
this.hide = false // FIXME: Replace render with hide
|
||||
this.hidden = false
|
||||
this.attributes = new Attributes()
|
||||
this.points = {}
|
||||
this.paths = {}
|
||||
|
@ -72,6 +71,41 @@ Part.prototype.getId = function (prefix = '') {
|
|||
return prefix + this.freeId
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the part
|
||||
*
|
||||
* @return {Part} part - The Part instance
|
||||
*/
|
||||
Part.prototype.hide = function () {
|
||||
this.hidden = true
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Reveal the part - alias for part.unhide()
|
||||
*
|
||||
* @return {Part} part - The Part instance
|
||||
*/
|
||||
Part.prototype.reveal = function () {
|
||||
this.unhide()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hidden attribute
|
||||
*
|
||||
* @param {boolean} hidden - The value to set the hidden property to
|
||||
* @return {Part} this - The Part instance
|
||||
*/
|
||||
Part.prototype.setHidden = function (hidden = false) {
|
||||
if (hidden) this.hidden = true
|
||||
else this.hidden = false
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/** Returns an object with shorthand access for pattern design */
|
||||
/**
|
||||
* Returns an object that will be passed to draft method to be destructured
|
||||
|
@ -83,19 +117,19 @@ Part.prototype.shorthand = function () {
|
|||
const paperless = this.context.settings?.paperless === true ? true : false
|
||||
const sa = this.context.settings?.complete ? this.context.settings?.sa || 0 : 0
|
||||
const shorthand = {
|
||||
complete,
|
||||
hide: this.hide,
|
||||
log: this.context.store.log,
|
||||
macro: this.__macroClosure(),
|
||||
paperless,
|
||||
part: this,
|
||||
reveal: this.reveal,
|
||||
sa,
|
||||
scale: this.context.settings?.scale,
|
||||
store: this.context.store,
|
||||
macro: this.__macroClosure(),
|
||||
unhide: this.unhide,
|
||||
units: this.__unitsClosure(),
|
||||
utils: utils,
|
||||
complete,
|
||||
paperless,
|
||||
events: this.context.events,
|
||||
log: this.context.store.log,
|
||||
addCut: this.addCut,
|
||||
removeCut: this.removeCut,
|
||||
}
|
||||
// Add top-level store methods and add a part name parameter
|
||||
const partName = this.name
|
||||
|
@ -170,6 +204,17 @@ Part.prototype.shorthand = function () {
|
|||
return shorthand
|
||||
}
|
||||
|
||||
/**
|
||||
* Unhide the part - alias for part.reveal()
|
||||
*
|
||||
* @return {Part} part - The Part instance
|
||||
*/
|
||||
Part.prototype.unhide = function () {
|
||||
this.hidden = false
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a value formatted for units set in settings
|
||||
*
|
||||
|
@ -198,7 +243,7 @@ Part.prototype.__boundary = function () {
|
|||
for (let key in this.paths) {
|
||||
try {
|
||||
let path = this.paths[key].__boundary()
|
||||
if (path.render) {
|
||||
if (!path.hidden) {
|
||||
if (path.topLeft.x < topLeft.x) topLeft.x = path.topLeft.x
|
||||
if (path.topLeft.y < topLeft.y) topLeft.y = path.topLeft.y
|
||||
if (path.bottomRight.x > bottomRight.x) bottomRight.x = path.bottomRight.x
|
||||
|
|
|
@ -24,12 +24,11 @@ import {
|
|||
*/
|
||||
export function Path() {
|
||||
// Enumerable properties
|
||||
this.hide = false
|
||||
this.hidden = false
|
||||
this.ops = []
|
||||
this.attributes = new Attributes()
|
||||
this.topLeft = false
|
||||
this.bottomRight = false
|
||||
this.render = true
|
||||
|
||||
return this
|
||||
}
|
||||
|
@ -158,7 +157,7 @@ Path.prototype.bbox = function () {
|
|||
* @return {Path} clone - A clone of this Path instance
|
||||
*/
|
||||
Path.prototype.clone = function () {
|
||||
let clone = new Path().__withLog(this.log).setRender(this.render)
|
||||
let clone = new Path().__withLog(this.log).setHidden(this.hidden)
|
||||
if (this.topLeft) clone.topLeft = this.topLeft.clone()
|
||||
else clone.topLeft = false
|
||||
if (this.bottomRight) clone.bottomRight = this.bottomRight.clone()
|
||||
|
@ -313,6 +312,17 @@ Path.prototype.end = function () {
|
|||
else return op.to
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the path
|
||||
*
|
||||
* @return {Path} path - The Path instance
|
||||
*/
|
||||
Path.prototype.hide = function () {
|
||||
this.hidden = true
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a noop operation with the ops from path
|
||||
*
|
||||
|
@ -521,6 +531,17 @@ Path.prototype.offset = function (distance) {
|
|||
return __pathOffset(this, distance, this.log)
|
||||
}
|
||||
|
||||
/**
|
||||
* Reveal the path - alias for path.unhide()
|
||||
*
|
||||
* @return {Path} path - The Path instance
|
||||
*/
|
||||
Path.prototype.reveal = function () {
|
||||
this.unhide()
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reversed version of this Path
|
||||
*
|
||||
|
@ -590,10 +611,15 @@ Path.prototype.setClass = function (className = false) {
|
|||
return this
|
||||
}
|
||||
|
||||
/** FIXME: This should go */
|
||||
Path.prototype.setRender = function (render = true) {
|
||||
if (render) this.render = true
|
||||
else this.render = false
|
||||
/**
|
||||
* Set the hidden attribute
|
||||
*
|
||||
* @param {boolean} hidden - The value to set the hidden property to
|
||||
* @return {object} this - The Path instance
|
||||
*/
|
||||
Path.prototype.setHidden = function (hidden = false) {
|
||||
if (hidden) this.hidden = true
|
||||
else this.hidden = false
|
||||
|
||||
return this
|
||||
}
|
||||
|
@ -833,6 +859,17 @@ Path.prototype.trim = function () {
|
|||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Unhide the path - alias for path.reveal()
|
||||
*
|
||||
* @return {Path} path - The Path instance
|
||||
*/
|
||||
Path.prototype.unhide = function () {
|
||||
this.hidden = false
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// PRIVATE METHODS //
|
||||
//////////////////////////////////////////////
|
||||
|
@ -956,9 +993,6 @@ Path.prototype.__withLog = function (log = false) {
|
|||
return this
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
// PUBLIC STATIC METHODS //
|
||||
//////////////////////////////////////////////
|
||||
|
@ -1217,8 +1251,9 @@ function shiftAlongBezier(distance, bezier, steps = false) {
|
|||
.curve(
|
||||
new Point(...Object.values(bezier.points[1])),
|
||||
new Point(...Object.values(bezier.points[2])),
|
||||
new Point(...Object.values(bezier.points[3])),
|
||||
).roughLength()
|
||||
new Point(...Object.values(bezier.points[3]))
|
||||
)
|
||||
.roughLength()
|
||||
if (rlen < 2) steps = 20
|
||||
else if (rlen < 10) steps = 40
|
||||
else if (rlen < 100) steps = 100
|
||||
|
|
|
@ -128,19 +128,19 @@ Pattern.prototype.draft = function () {
|
|||
}
|
||||
} else this.stores[set].log.error(`Unable to draft pattern. Part.draft() is not callable`)
|
||||
try {
|
||||
this.parts[set][partName].render =
|
||||
this.parts[set][partName].render === false ? false : this.__wants(partName, set)
|
||||
this.parts[set][partName].hidden =
|
||||
this.parts[set][partName].hidden === true ? true : !this.__wants(partName, set)
|
||||
} catch (err) {
|
||||
this.stores[set].log.error([
|
||||
`Unable to set \`render\` property on part \`${partName}\``,
|
||||
`Unable to set \`hidden\` property on part \`${partName}\``,
|
||||
err,
|
||||
])
|
||||
}
|
||||
} else {
|
||||
this.stores[set].log.debug(
|
||||
`Part \`${partName}\` is not needed. Skipping draft and setting render to \`false\``
|
||||
`Part \`${partName}\` is not needed. Skipping draft and setting hidden to \`true\``
|
||||
)
|
||||
this.parts[set][partName].render = false
|
||||
this.parts[set][partName].hidden = true
|
||||
}
|
||||
}
|
||||
this.__runHooks('postDraft')
|
||||
|
@ -149,6 +149,15 @@ Pattern.prototype.draft = function () {
|
|||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the initialized configuration
|
||||
*
|
||||
* @return {object} config - The initialized config
|
||||
*/
|
||||
Pattern.prototype.getConfig = function () {
|
||||
return this.init().config
|
||||
}
|
||||
|
||||
/** Returns props required to render this pattern through
|
||||
* an external renderer (eg. a React component)
|
||||
*
|
||||
|
@ -176,7 +185,7 @@ Pattern.prototype.getRenderProps = function () {
|
|||
}))
|
||||
props.parts = {}
|
||||
for (let p in this.parts) {
|
||||
if (this.parts[p].render) {
|
||||
if (!this.parts[p].hidden) {
|
||||
props.parts[p] = {
|
||||
paths: this.parts[p].paths,
|
||||
points: this.parts[p].points,
|
||||
|
|
|
@ -57,16 +57,16 @@ Svg.prototype.render = function (pattern) {
|
|||
this.tail = this.__renderTail()
|
||||
this.svg = ''
|
||||
this.layout = {} // Reset layout
|
||||
for (let partId in pattern.parts) {
|
||||
let part = pattern.parts[partId]
|
||||
if (part.render) {
|
||||
let partSvg = this.__renderPart(part)
|
||||
this.layout[partId] = {
|
||||
svg: partSvg,
|
||||
transform: part.attributes.getAsArray('transform'),
|
||||
for (let stackId in pattern.stacks) {
|
||||
const stack = pattern.stacks[stackId]
|
||||
if (!stack.hidden) {
|
||||
const stackSvg = this.__renderStack(stack)
|
||||
this.layout[stackId] = {
|
||||
svg: stackSvg,
|
||||
transform: stack.attributes.getAsArray('transform'),
|
||||
}
|
||||
this.svg += this.__openGroup(`${this.idPrefix}part-${partId}`, part.attributes)
|
||||
this.svg += partSvg
|
||||
this.svg += this.__openGroup(`${this.idPrefix}stack-${stackId}`, stack.attributes)
|
||||
this.svg += stackSvg
|
||||
this.svg += this.__closeGroup()
|
||||
}
|
||||
}
|
||||
|
@ -279,11 +279,11 @@ Svg.prototype.__renderPathText = function (path) {
|
|||
* @param {Part} part - The Part instance to render
|
||||
* @return {string} svg - The SVG markup for the Part object
|
||||
*/
|
||||
Svg.prototype.__renderPart = function (part) {
|
||||
let svg = ''
|
||||
Svg.prototype.__renderPart = function (part, partId) {
|
||||
let svg = this.__openGroup(`${this.idPrefix}part-${partId}`, part.attributes)
|
||||
for (let key in part.paths) {
|
||||
let path = part.paths[key]
|
||||
if (path.render) svg += this.__renderPath(path)
|
||||
if (!path.hidden) svg += this.__renderPath(path)
|
||||
}
|
||||
for (let key in part.points) {
|
||||
if (part.points[key].attributes.get('data-text')) {
|
||||
|
@ -297,6 +297,7 @@ Svg.prototype.__renderPart = function (part) {
|
|||
let snippet = part.snippets[key]
|
||||
svg += this.__renderSnippet(snippet, part)
|
||||
}
|
||||
svg += this.__closeGroup()
|
||||
|
||||
return svg
|
||||
}
|
||||
|
@ -346,6 +347,20 @@ Svg.prototype.__renderSnippet = function (snippet) {
|
|||
return svg
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns SVG markup for a Stack object
|
||||
*
|
||||
* @private
|
||||
* @param {Stack} stack - The Stack instance to render
|
||||
* @return {string} svg - The SVG markup for the Stack object
|
||||
*/
|
||||
Svg.prototype.__renderStack = function (stack) {
|
||||
let svg = ''
|
||||
for (const part of stack.parts) svg += this.__renderPart(part)
|
||||
|
||||
return svg
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns SVG markup for the style block
|
||||
*
|
||||
|
|
|
@ -689,9 +689,9 @@ describe('Path', () => {
|
|||
expect(p1.log()).to.equal('hello')
|
||||
})
|
||||
|
||||
it('Should set render to true/false', () => {
|
||||
const p1 = new Path().setRender(false)
|
||||
expect(p1.render).to.equal(false)
|
||||
it('Should set hidden to true/false', () => {
|
||||
const p1 = new Path().setHidden(true)
|
||||
expect(p1.hidden).to.equal(true)
|
||||
})
|
||||
|
||||
it('Should set class with setClass', () => {
|
||||
|
|
|
@ -32,7 +32,7 @@ export const plugin = {
|
|||
this.points[prefix + 'Cp2'],
|
||||
this.points[prefix + 'p2']
|
||||
)
|
||||
.setRender(false)
|
||||
.hide()
|
||||
|
||||
this.points[prefix + 'p2'] = this.paths.auxiliaryPath.intersectsX(0)[0] //the new point p2 is the one in which the auxiliary curve intersects x=0
|
||||
this.paths.auxiliaryPath = this.paths.auxiliaryPath.split(this.points[prefix + 'p2'])[0] //the auxiliary curve is split
|
||||
|
@ -51,8 +51,8 @@ export const plugin = {
|
|||
.close()
|
||||
.attr('class', so.class ? so.class : '')
|
||||
|
||||
if (typeof so.render !== 'undefined' && so.render) this.paths[prefix + 'seam'].render = true
|
||||
else this.paths[prefix + 'seam'].render = false
|
||||
if (so?.hidden) this.paths[prefix + 'seam'].hide()
|
||||
else this.paths[prefix + 'seam'].unhide()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -31,9 +31,8 @@ export const plugin = {
|
|||
this.points[prefix + 'End']
|
||||
)
|
||||
.attr('class', so.class ? so.class : '')
|
||||
if (typeof so.render !== 'undefined' && so.render)
|
||||
this.paths[prefix + 'Rounded'].render = true
|
||||
else this.paths[prefix + 'Rounded'].render = false
|
||||
if (so?.hidden) this.paths[prefix + 'Rounded'].hide()
|
||||
else this.paths[prefix + 'Rounded'].unhide()
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ export const plugin = {
|
|||
: (svg.defs += grid.metric)
|
||||
for (const key in svg.pattern.parts) {
|
||||
const part = svg.pattern.parts[key]
|
||||
if (part.render && svg.pattern.needs(key)) {
|
||||
if (!part.hidden && svg.pattern.needs(key)) {
|
||||
let anchor = new svg.pattern.Point(0, 0)
|
||||
if (typeof part.points.gridAnchor !== 'undefined') anchor = part.points.gridAnchor
|
||||
else if (typeof part.points.anchor !== 'undefined') anchor = part.points.anchor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue