diff --git a/.gitignore b/.gitignore index 3dbc88d0866..8fbcd82261c 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,9 @@ scripts/verdaccio.sh !markdown/dev/reference/api/point/dist .test-failures.log +package.json +yarn.lock +yarn.lock +package.json +packages/ursula/example/src/pattern +packages/ursula/example/src/pattern diff --git a/designs/ursula/src/back2.js b/designs/ursula/src/back2.js new file mode 100644 index 00000000000..367f470c679 --- /dev/null +++ b/designs/ursula/src/back2.js @@ -0,0 +1,65 @@ +export default function (part) { + let { + options, + Point, + Path, + points, + paths, + measurements, + Snippet, + snippets, + store, + utils, + complete, + sa, + paperless, + macro, + } = part.shorthand() + +console.log('bla') + +points.waist2 = points.backWaistBandMid; + +points.leg4L = points.backLegOpeningLeft; +points.leg4R = points.leg4L.flipX(points.backWaistMid); + +snippets.waist2 = new Snippet("notch", points.waist2); +snippets.leg4L = new Snippet("notch", points.leg4L); +snippets.leg4R = new Snippet("notch", points.leg4R); + +console.log('store',store) + +if (store.get('numWaistMarkersFront') < 3) { + // backWaistBand extends from right to left, so use (0.5 - waistMarkerFrac) + points.waist1R = paths.backWaistBand.shiftFractionAlong(0.5 - store.get('waistMarkerFrac')); + points.waist1L = points.waist1R.flipX(points.backWaistMid); + + snippets.waist1L = new Snippet("notch", points.waist1L); + snippets.waist1R = new Snippet("notch", points.waist1R); +} + +console.log('bla') + +if (store.get('numLegMarkersFront') + store.get('numLegMarkersGusset') < 2) { + // draw second marker, on back + // use (1 - frac) because the path is drawn from gusset to waist + points.leg2R = paths.backLegOpening.shiftFractionAlong(1 - store.get('legMarker2Frac')); + points.leg2L = points.leg2R.flipX(points.backWaistMid); + + snippets.leg2L = new Snippet("notch", points.leg2L); + snippets.leg2R = new Snippet("notch", points.leg2R); +} +console.log('bla') + +if (store.get('numLegMarkersFront') + store.get('numLegMarkersGusset') < 3) { + // draw third marker, on back + // use (1 - frac) because the path is drawn from gusset to waist + points.leg3R = paths.backLegOpening.shiftFractionAlong(1 - store.get('legMarker3Frac')); + points.leg3L = points.leg3R.flipX(points.backWaistMid); + + snippets.leg3L = new Snippet("notch", points.leg3L); + snippets.leg3R = new Snippet("notch", points.leg3R); +} + + return part +} diff --git a/designs/ursula/src/elastic.js b/designs/ursula/src/elastic.js index bdedf627f06..4101a9a0a78 100644 --- a/designs/ursula/src/elastic.js +++ b/designs/ursula/src/elastic.js @@ -28,6 +28,67 @@ export default function (part) { y: points.elasticInfo.y + sa + 15, }) } + + console.log('elastic complete') + + // determine where the markers should be drawn + + // waist band: start at center front + if (store.get('frontWaistBandLength') >= waistBandLength / 2) { + store.set('numWaistMarkersFront',3); + store.set('waistMarkerFrac', 0.25 * waistBandLength / store.get('frontWaistBandLength')); + } else { + store.set('numWaistMarkersFront',1); + store.set('waistMarkerFrac', 0.25 * waistBandLength / store.get('backWaistBandLength')); + } + + // leg opening: start at side seam (marker 0, does not count towards total) + // leg marker 1: at 25%, on either front or gusset + // leg marker 2: at 50%, on front, gusset or back + // leg marker 3: at 75%, on gusset or back + // for any part, 'legMarker#Frac' gives the relative position along the path *on that part*, measured from front/back to gusset and from front of gusset to back of gusset + + // markers on front part + if (store.get('frontLegOpeningLength') / legOpeningLength < 0.25 ) { + store.set('numLegMarkersFront',0); // side seam only (count markers per leg opening) + } else { + store.set('numLegMarkersFront',1); + store.set('legMarker1Frac',0.25 * legOpeningLength / store.get('frontLegOpeningLength')); + } + if (store.get('frontLegOpeningLength') / legOpeningLength >= 0.5 ) { + // seems unlikely: front leg opening is at least 50% of total + store.set('numLegMarkersFront',2); + store.set('legMarker2Frac',0.5 * legOpeningLength / store.get('frontLegOpeningLength')); + } + + // markers on gusset + store.set('numLegMarkersGusset',0) + if (store.get('frontLegOpeningLength') / legOpeningLength < 0.25 & + (store.get('frontLegOpeningLength') + store.get('gussetSideLength')) / legOpeningLength > 0.25) { + store.set('numLegMarkersGusset',1); + store.set('legMarker1Frac', (0.25 * legOpeningLength - store.get('frontLegOpeningLength')) / store.get('gussetSideLength')) + } + if (store.get('frontLegOpeningLength') / legOpeningLength < 0.5 & + (store.get('frontLegOpeningLength') + store.get('gussetSideLength')) / legOpeningLength >= 0.5) { + // place second marker on gusset + store.set('numLegMarkersGusset',1 + store.get('numLegMarkersGusset')); + store.set('legMarker2Frac', (0.5 * legOpeningLength - store.get('frontLegOpeningLength')) / store.get('gussetSideLength')) + } + if (store.get('frontLegOpeningLength') / legOpeningLength < 0.75 & + (store.get('frontLegOpeningLength') + store.get('gussetSideLength')) / legOpeningLength >= 0.75) { + // place second marker on gusset + store.set('numLegMarkersGusset',1 + store.get('numLegMarkersGusset')); + store.set('legMarker3Frac', (0.75 * legOpeningLength - store.get('frontLegOpeningLength')) / store.get('gussetSideLength')) + } + + // markers on back part + if (store.get('backLegOpeningLength') / legOpeningLength > 0.25 ) { + store.set('legMarker3Frac',0.25 * legOpeningLength / store.get('backLegOpeningLength')); + } + if (store.get('backLegOpeningLength') / legOpeningLength > 0.5 ) { + store.set('legMarker2Frac',0.5 * legOpeningLength / store.get('backLegOpeningLength')); + } + return part } diff --git a/designs/ursula/src/front2.js b/designs/ursula/src/front2.js new file mode 100644 index 00000000000..b50b441aac8 --- /dev/null +++ b/designs/ursula/src/front2.js @@ -0,0 +1,61 @@ +export default function (part) { + let { + options, + Point, + Path, + points, + paths, + measurements, + Snippet, + snippets, + store, + utils, + complete, + sa, + paperless, + macro, + } = part.shorthand() + +console.log('start front2') + +// draw markers to indicate elastic distribution +points.waist0 = points.frontWaistBandMid; + +points.leg0L = points.frontLegOpeningLeft; +points.leg0R = points.leg0L.flipX(points.frontWaistMid); + +snippets.waist0 = new Snippet("notch", points.waist0); +snippets.leg0L = new Snippet("notch", points.leg0L); +snippets.leg0R = new Snippet("notch", points.leg0R); + +if (store.get('numWaistMarkersFront') > 1) { + // frontWaistBandLength extends from right to left, so use (0.5 - waistMarkerFrac) + points.waist1R = paths.frontWaistBand.shiftFractionAlong(0.5 - store.get('waistMarkerFrac')); + points.waist1L = points.waist1L.flipX(points.frontWaistMid); + + snippets.waist1L = new Snippet("notch", points.waist1L); + snippets.waist1R = new Snippet("notch", points.waist1R); +} + +if (store.get('numLegMarkersFront') > 0) { + // use (1 - frac) because the path is drawn from gusset to side seam + points.leg1L = paths.frontLegOpening.shiftFractionAlong(1 - store.get('legMarker1Frac')); + points.leg1R = points.leg1L.flipX(points.frontWaistMid); + + snippets.leg1L = new Snippet("notch", points.leg1L); + snippets.leg1R = new Snippet("notch", points.leg1R); +} + +if (store.get('numLegMarkersFront') > 1) { + // use (1 - frac) because the path is drawn from gusset to side seam + points.leg2L = paths.frontLegOpening.shiftFractionAlong(1 - store.get('legMarker2Frac')); + points.leg2R = points.leg2L.flipX(points.frontWaistMid); + + snippets.leg2L = new Snippet("notch", points.leg2L); + snippets.leg2R = new Snippet("notch", points.leg2R); +} + +console.log('markers along paths') + + return part +} diff --git a/designs/ursula/src/gusset.js b/designs/ursula/src/gusset.js index 377073cdaf5..ce2363a3d50 100644 --- a/designs/ursula/src/gusset.js +++ b/designs/ursula/src/gusset.js @@ -26,13 +26,11 @@ export default function (part) { points.frontMidMid = points.gussetCp1.shiftFractionTowards(points.gussetCp2, 0.5) /* Store lengths for use in elastic */ - store.set( - 'gussetSideLength', - new Path() + paths.gussetLegOpening = new Path() .move(points.backGussetRight) .curve(points.backGussetRight, points.gussetCp2, points.frontGussetRight) - .length() - ) + .setRender(false) + store.set('gussetSideLength',paths.gussetLegOpening.length()) // Draw paths paths.seam = new Path() diff --git a/designs/ursula/src/gusset2.js b/designs/ursula/src/gusset2.js new file mode 100644 index 00000000000..b058bc52f2a --- /dev/null +++ b/designs/ursula/src/gusset2.js @@ -0,0 +1,49 @@ +export default function (part) { + let { + options, + Point, + Path, + points, + paths, + measurements, + Snippet, + snippets, + store, + utils, + complete, + sa, + paperless, + macro, + } = part.shorthand() + +// draw markers to indicate elastic distribution +if (store.get('numLegMarkersFront') < 1 & store.get('numLegMarkersGusset') > 0) { + // draw first marker, on gusset + // use (1 - frac) because the path is drawn from back to front + points.leg1L = paths.gussetLegOpening.shiftFractionAlong(1 - store.get('legMarker1Frac')); + points.leg1R = points.leg1L.flipX(store.get('frontGussetMid')); + + snippets.leg1L = new Snippet("notch", points.leg1L); + snippets.leg1R = new Snippet("notch", points.leg1R); +} +if (store.get('numLegMarkersFront') < 2 & (store.get('numLegMarkersFront') + store.get('numLegMarkersGusset')) > 1) { + // draw second marker, on gusset + // use (1 - frac) because the path is drawn from back to front + points.leg2L = paths.gussetLegOpening.shiftFractionAlong(1 - store.get('legMarker2Frac')); + points.leg2R = points.leg2L.flipX(store.get('frontGussetMid')); + + snippets.leg2L = new Snippet("notch", points.leg2L); + snippets.leg2R = new Snippet("notch", points.leg2R); +} +if (store.get('numLegMarkersFront') < 3 & (store.get('numLegMarkersFront') + store.get('numLegMarkersGusset')) > 3) { + // draw third marker, on gusset + // use (1 - frac) because the path is drawn from back to front + points.leg3L = paths.gussetLegOpening.shiftFractionAlong(1 - store.get('legMarker3Frac')); + points.leg3R = points.leg3L.flipX(store.get('frontGussetMid')); + + snippets.leg3L = new Snippet("notch", points.leg3L); + snippets.leg3R = new Snippet("notch", points.leg3R); +} + + return part +} diff --git a/package.json b/package.json index 08151dff373..d67c07ba674 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,6 @@ "react-dom": "^17.0.2", "react-intl": "^5.17.6", "react-markdown": "^6.0.2", - "react-scripts": "^5.0.0", "remark": "^13.0.0", "remark-html": "^13.0.1", "rimraf": "^3.0.2", @@ -148,6 +147,7 @@ "remark-lint-list-item-indent": "^3.1.1", "remark-preset-lint-consistent": "^5.1.1", "remark-preset-lint-recommended": "^6.1.2", - "tailwindcss": "^3.0.7" + "tailwindcss": "^3.0.7", + "url-loader": "^4.1.1" } }