sparkles: Initial port of aaron from PHP to JS
This commit is contained in:
parent
aebcf8e3ad
commit
255a94f97d
9 changed files with 307 additions and 255 deletions
1
packages/aaron/bundle.js
Symbolic link
1
packages/aaron/bundle.js
Symbolic link
|
@ -0,0 +1 @@
|
|||
../plugins/plugin-bundle/dist/browser.js
|
|
@ -20,18 +20,18 @@ export default {
|
|||
collarEase: 0,
|
||||
frontArmholeDeeper: 0,
|
||||
armholeDepthFactor: 0.6,
|
||||
shoulderSlopeReduction: 0,
|
||||
|
||||
// Percentages
|
||||
armholeDrop: { val: 10, min: 0, max: 50 },
|
||||
backlineBend: { val: 0, min: 0, max: 8 },
|
||||
armholeDrop: { val: 10, min: 1, max: 75 },
|
||||
backlineBend: { val: 50, min: 50, max: 100 },
|
||||
chestEase: { val: 8, min: 0, max: 20 },
|
||||
hipsEase: { val: 8, min: 0, max: 20 },
|
||||
lengthBonus: { val: 10, min:-20, max: 60 },
|
||||
necklineBend: { val: 60, min: 40, max: 100 },
|
||||
necklineDrop: { val: 15, min: 10, max: 35 },
|
||||
shoulderSlopeReduction: { val: 0, min: 0, max: 8 },
|
||||
necklineBend: { val: 100, min: 40, max: 100 },
|
||||
necklineDrop: { val: 20, min: 10, max: 35 },
|
||||
stretchFactor: { val: 5, min: 0, max: 15 },
|
||||
shoulderStrapWidth: { val: 20, min: 10, max: 40 },
|
||||
shoulderStrapPlacement: { val: 50, min: 20, max: 80 },
|
||||
shoulderStrapWidth: { val: 15, min: 10, max: 40 },
|
||||
shoulderStrapPlacement: { val: 40, min: 20, max: 80 },
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,58 +6,58 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="svg"></div>
|
||||
<script src="freesewing.js"></script>
|
||||
<script src="https://unpkg.com/freesewing"></script>
|
||||
<script src="https://unpkg.com/@freesewing/plugin-bundle"></script>
|
||||
<script src="brian.js"></script>
|
||||
<script src="https://unpkg.com/@freesewing/brian"></script>
|
||||
<script src="dist/browser.js"></script>
|
||||
<script src="tmp/theme.js"></script>
|
||||
<script src="tmp/designer.js"></script>
|
||||
<script src="tmp/models.js"></script>
|
||||
<script src="tmp/antmantest.js"></script>
|
||||
<script src="tmp/validate.js"></script>
|
||||
<script src="tmp/debug.js"></script>
|
||||
<script>
|
||||
var pattern = freesewing.patterns.aaron
|
||||
.with(freesewing.plugins.validate)
|
||||
.with(freesewing.plugins.debug)
|
||||
.with(freesewing.plugins.theme)
|
||||
.with(freesewing.plugins.designer)
|
||||
console.log('freesewing', freesewing);
|
||||
<script src="https://unpkg.com/@freesewing/plugin-theme"></script>
|
||||
<script src="https://unpkg.com/@freesewing/plugin-designer"></script>
|
||||
<script src="https://unpkg.com/@freesewing/plugin-validate"></script>
|
||||
<script src="https://unpkg.com/@freesewing/plugin-debug"></script>
|
||||
<script src="https://unpkg.com/@freesewing/models"></script>
|
||||
<script src="https://unpkg.com/@freesewing/antman"></script>
|
||||
<script>
|
||||
var pattern = freesewing.patterns.aaron
|
||||
.with(freesewing.plugins.validate)
|
||||
.with(freesewing.plugins.debug)
|
||||
.with(freesewing.plugins.theme)
|
||||
.with(freesewing.plugins.designer)
|
||||
|
||||
//pattern.settings.paperless = true;
|
||||
pattern.settings.measurements = freesewing.models.men.manSize36;
|
||||
pattern.settings.paperless = true;
|
||||
pattern.settings.measurements = freesewing.models.men.manSize36;
|
||||
pattern.settings.sa = 10;
|
||||
pattern.settings.units = 'metric';
|
||||
pattern.settings.sample = {
|
||||
type: 'measurement',
|
||||
measurement: 'shoulderToShoulder'
|
||||
}
|
||||
|
||||
pattern.settings.sa = 10;
|
||||
pattern.settings.units = 'metric';
|
||||
pattern.settings.sample = {
|
||||
type: 'measurement',
|
||||
measurement: 'shoulderToShoulder'
|
||||
}
|
||||
//pattern.sampleOption('lengthBonus');
|
||||
//pattern.sampleMeasurement('bicepsCircumference');
|
||||
//pattern.sampleModels(freesewing.antmantest);
|
||||
pattern.draft();
|
||||
document.getElementById("svg").innerHTML = pattern.render();
|
||||
//pattern.sampleOption('backlineBend');
|
||||
//pattern.sampleMeasurement('bicepsCircumference');
|
||||
//pattern.sampleModels(freesewing.models.men);
|
||||
pattern.draft();
|
||||
//pattern.sample();
|
||||
document.getElementById("svg").innerHTML = pattern.render();
|
||||
|
||||
function pointHover(evt) {
|
||||
var point = evt.target;
|
||||
var id = point.id;
|
||||
var cx = point.getAttribute('x');
|
||||
var cy = point.getAttribute('y');
|
||||
var name = point.getAttribute('data-point');
|
||||
var part = point.getAttribute('data-part');
|
||||
console.log(name+' ('+cx+', '+cy+') @ '+part);
|
||||
var scale = 2;
|
||||
cx = cx-scale*cx;
|
||||
cy = cy-scale*cy;
|
||||
point.setAttribute("transform", 'matrix('+scale+', 0, 0, '+scale+', '+cx+', '+cy+')');
|
||||
pointUnhover(id);
|
||||
}
|
||||
function pointUnhover(id) {
|
||||
setTimeout(function(){
|
||||
document.getElementById(id).removeAttribute("transform", '');
|
||||
}, 500);
|
||||
}
|
||||
</script>
|
||||
function pointHover(evt) {
|
||||
var point = evt.target;
|
||||
var id = point.id;
|
||||
var cx = point.getAttribute('x');
|
||||
var cy = point.getAttribute('y');
|
||||
var name = point.getAttribute('data-point');
|
||||
var part = point.getAttribute('data-part');
|
||||
console.log(name+' ('+cx+', '+cy+') @ '+part);
|
||||
var scale = 2;
|
||||
cx = cx-scale*cx;
|
||||
cy = cy-scale*cy;
|
||||
point.setAttribute("transform", 'matrix('+scale+', 0, 0, '+scale+', '+cx+', '+cy+')');
|
||||
pointUnhover(id);
|
||||
}
|
||||
function pointUnhover(id) {
|
||||
setTimeout(function(){
|
||||
document.getElementById(id).removeAttribute("transform", '');
|
||||
}, 500);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
144
packages/aaron/package-lock.json
generated
144
packages/aaron/package-lock.json
generated
|
@ -911,52 +911,96 @@
|
|||
}
|
||||
},
|
||||
"@freesewing/brian": {
|
||||
"version": "0.6.6",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/brian/-/brian-0.6.6.tgz",
|
||||
"integrity": "sha512-ewoeHooiHEr1nXdWU0yK24cDODdnNPLK1KyMF+Vc3RIje9z8nKgn7IZR1cZTEjz9TuppAvZGCHkS2xJ8HGU6kw==",
|
||||
"version": "0.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/brian/-/brian-0.7.3.tgz",
|
||||
"integrity": "sha512-Oh3R1AHgN5zzl40Y8aqHoMB5Zkx7crkqq5J1/0nRN6hqDp2pH1IA5EP2gGr1NhsHAWZtxcnbYisoNg0l3NNM5g==",
|
||||
"requires": {
|
||||
"@freesewing/plugin-bundle": "0.0.1",
|
||||
"freesewing": "0.6.2"
|
||||
}
|
||||
},
|
||||
"@freesewing/plugin-bundle": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.0.1.tgz",
|
||||
"integrity": "sha512-LLqw/HD23K1XmnuoPUbUK9PhrawcKemYn8eBjt1Jvqn9xD6HvndPeB8nwJ4/i/L02yA8ZqXTDnGvi5gMzc0kVw==",
|
||||
"requires": {
|
||||
"@freesewing/plugin-cutonfold": "0.9.0",
|
||||
"@freesewing/plugin-dimension": "0.4.0",
|
||||
"@freesewing/plugin-grainline": "0.0.2",
|
||||
"@freesewing/plugin-logo": "0.3.2",
|
||||
"@freesewing/plugin-title": "0.6.2"
|
||||
"@freesewing/plugin-bundle": "0.1.6",
|
||||
"freesewing": "0.10.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@freesewing/plugin-cutonfold": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-cutonfold/-/plugin-cutonfold-0.9.0.tgz",
|
||||
"integrity": "sha512-FZC6bSaDMgXKDzIU5ynByHmiVIVDXKzB9rlxZyldv+q8c0T/xfJ/x15wcey2Bffj/pv37hzLI+CocwGLHjWH7g=="
|
||||
"@freesewing/plugin-bundle": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.1.6.tgz",
|
||||
"integrity": "sha512-XhkI8bCbRQjsDoLJOpCtLc3YQbD54VPnhimso2cVonkICXW4TufgfRUQ/SNPfWBecblhaZkppF7mLpOcWZaXjQ==",
|
||||
"requires": {
|
||||
"@freesewing/plugin-cutonfold": "0.9.0",
|
||||
"@freesewing/plugin-dimension": "0.5.2",
|
||||
"@freesewing/plugin-grainline": "0.0.3",
|
||||
"@freesewing/plugin-logo": "0.3.3",
|
||||
"@freesewing/plugin-scalebox": "0.1.0",
|
||||
"@freesewing/plugin-title": "0.6.2"
|
||||
}
|
||||
},
|
||||
"@freesewing/plugin-dimension": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-dimension/-/plugin-dimension-0.5.2.tgz",
|
||||
"integrity": "sha512-84wqa905cwprdKw8vqs5/y8VvphXdkeUgCgzfY28Y6N1L1MhKOn/Dpux2C9AN5xUpFv/aopuId/9b8fGjTuZww=="
|
||||
},
|
||||
"@freesewing/plugin-grainline": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-grainline/-/plugin-grainline-0.0.2.tgz",
|
||||
"integrity": "sha512-9aaUvxK9rdXMpOZhR+/Ew8VDa9CFmDKF8lULupETd99h0E8XT6iTVeiRWuufQ1hpidYzfshN3Iz2VIIjURj+mA=="
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-grainline/-/plugin-grainline-0.0.3.tgz",
|
||||
"integrity": "sha512-Oa+FvjsdDfWxIoXa8bATYwj1Neg6q+gNQWJyX7j1HlJnEflsQtJBB8fqwcGJzeK/QDJauvbAm3sBJP30gMwSTw=="
|
||||
},
|
||||
"@freesewing/plugin-logo": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-logo/-/plugin-logo-0.3.2.tgz",
|
||||
"integrity": "sha512-cYmMAcvWl7B0RC3LUaCNRVj98nDIsT47Uf+84fQAnsAeZeAyiA1Y1NmPlmb3n30znlFwiJYjII7cRBn73l6wGQ=="
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-logo/-/plugin-logo-0.3.3.tgz",
|
||||
"integrity": "sha512-t9VBoZvFx0tR83bFQMpc4iH/oJaXVr41zX0N8AogTt+FEjnHnZSmCJGTfpYkPtp1mWJSc4ibS95Gyh9c4YNgGA=="
|
||||
},
|
||||
"@freesewing/plugin-title": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-title/-/plugin-title-0.6.2.tgz",
|
||||
"integrity": "sha512-OpiM4qQ0kN8NAP/OZkjveiMcebwk/ZBwfng9sVFDxp3zAB1YisoYgYjFoURCqR7ePAMbAa66sXD+o0YgITR9wg=="
|
||||
"freesewing": {
|
||||
"version": "0.10.1",
|
||||
"resolved": "https://registry.npmjs.org/freesewing/-/freesewing-0.10.1.tgz",
|
||||
"integrity": "sha512-SUQ0xvIClT7krbnUujeymZ1qNtR69p8MDCcqdKpbp1XVzhvYIpQLDPBos01434HrKGF8RmMnZUFGZNsJ/g6TIA==",
|
||||
"requires": {
|
||||
"bezier-js": "2.2.14",
|
||||
"bin-pack": "1.0.2",
|
||||
"hooks": "0.3.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@freesewing/plugin-bundle": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-bundle/-/plugin-bundle-0.1.6.tgz",
|
||||
"integrity": "sha512-XhkI8bCbRQjsDoLJOpCtLc3YQbD54VPnhimso2cVonkICXW4TufgfRUQ/SNPfWBecblhaZkppF7mLpOcWZaXjQ==",
|
||||
"requires": {
|
||||
"@freesewing/plugin-cutonfold": "0.9.0",
|
||||
"@freesewing/plugin-dimension": "0.5.2",
|
||||
"@freesewing/plugin-grainline": "0.0.3",
|
||||
"@freesewing/plugin-logo": "0.3.3",
|
||||
"@freesewing/plugin-scalebox": "0.1.0",
|
||||
"@freesewing/plugin-title": "0.6.2"
|
||||
}
|
||||
},
|
||||
"@freesewing/plugin-cutonfold": {
|
||||
"version": "0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-cutonfold/-/plugin-cutonfold-0.9.0.tgz",
|
||||
"integrity": "sha512-FZC6bSaDMgXKDzIU5ynByHmiVIVDXKzB9rlxZyldv+q8c0T/xfJ/x15wcey2Bffj/pv37hzLI+CocwGLHjWH7g=="
|
||||
},
|
||||
"@freesewing/plugin-dimension": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-dimension/-/plugin-dimension-0.4.0.tgz",
|
||||
"integrity": "sha512-W4O3p4LlvNVt9bRG/2obKrzAWqX7MogdX2E1TYN8nJX0+KMBKArvQyR6RnODXWHuK2Mh+KZkF/dqVKqAc9EMDg=="
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-dimension/-/plugin-dimension-0.5.2.tgz",
|
||||
"integrity": "sha512-84wqa905cwprdKw8vqs5/y8VvphXdkeUgCgzfY28Y6N1L1MhKOn/Dpux2C9AN5xUpFv/aopuId/9b8fGjTuZww=="
|
||||
},
|
||||
"@freesewing/plugin-grainline": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-grainline/-/plugin-grainline-0.0.3.tgz",
|
||||
"integrity": "sha512-Oa+FvjsdDfWxIoXa8bATYwj1Neg6q+gNQWJyX7j1HlJnEflsQtJBB8fqwcGJzeK/QDJauvbAm3sBJP30gMwSTw=="
|
||||
},
|
||||
"@freesewing/plugin-logo": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-logo/-/plugin-logo-0.3.3.tgz",
|
||||
"integrity": "sha512-t9VBoZvFx0tR83bFQMpc4iH/oJaXVr41zX0N8AogTt+FEjnHnZSmCJGTfpYkPtp1mWJSc4ibS95Gyh9c4YNgGA=="
|
||||
},
|
||||
"@freesewing/plugin-scalebox": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-scalebox/-/plugin-scalebox-0.1.0.tgz",
|
||||
"integrity": "sha512-CKPM5BjJI4p0dLHIFlhaw+Zn7QCbCq9j8R50oSQGuarUXKD4g6Vp2uQYK9NVFbxHBy9PBRpnRSQueN4OEzGdTw=="
|
||||
},
|
||||
"@freesewing/plugin-title": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@freesewing/plugin-title/-/plugin-title-0.6.2.tgz",
|
||||
"integrity": "sha512-OpiM4qQ0kN8NAP/OZkjveiMcebwk/ZBwfng9sVFDxp3zAB1YisoYgYjFoURCqR7ePAMbAa66sXD+o0YgITR9wg=="
|
||||
},
|
||||
"@samverschueren/stream-to-observable": {
|
||||
"version": "0.3.0",
|
||||
|
@ -972,7 +1016,7 @@
|
|||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
|
||||
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
|
||||
"requires": {
|
||||
"mime-types": "2.1.19",
|
||||
"mime-types": "2.1.20",
|
||||
"negotiator": "0.6.1"
|
||||
}
|
||||
},
|
||||
|
@ -2886,9 +2930,9 @@
|
|||
}
|
||||
},
|
||||
"freesewing": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/freesewing/-/freesewing-0.6.2.tgz",
|
||||
"integrity": "sha512-6PhbiIRIOWWEOE0ZmQm7qGInnL1WA+dHFbVJkgAIBoBZUkEddIMxGSQV2/t3ZYyDad+jc+n5pjKSeWQgGu+7nQ==",
|
||||
"version": "0.10.2",
|
||||
"resolved": "https://registry.npmjs.org/freesewing/-/freesewing-0.10.2.tgz",
|
||||
"integrity": "sha512-TKS3J9lyx4CL5MNOHobiObRQGViCx6NJYr9tgr5QTXZ2Ledd2uaJDtN5dYCXaAXKdDV0Ejmv68jR7rp7G5KYFQ==",
|
||||
"requires": {
|
||||
"bezier-js": "2.2.14",
|
||||
"bin-pack": "1.0.2",
|
||||
|
@ -4803,7 +4847,7 @@
|
|||
"integrity": "sha1-RJhkS7+Bpm8Y3Y3/3vYcTBw3TKM=",
|
||||
"requires": {
|
||||
"chokidar": "1.7.0",
|
||||
"colors": "1.3.1",
|
||||
"colors": "1.3.2",
|
||||
"connect": "3.5.1",
|
||||
"cors": "2.8.4",
|
||||
"event-stream": "3.3.4",
|
||||
|
@ -4818,9 +4862,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"colors": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.3.1.tgz",
|
||||
"integrity": "sha512-jg/vxRmv430jixZrC+La5kMbUWqIg32/JsYNZb94+JEmzceYbWKTsv1OuTp+7EaqiaWRR2tPcykibwCRgclIsw=="
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.3.2.tgz",
|
||||
"integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ=="
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
@ -5027,16 +5071,16 @@
|
|||
"integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.35.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz",
|
||||
"integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg=="
|
||||
"version": "1.36.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz",
|
||||
"integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.19",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz",
|
||||
"integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==",
|
||||
"version": "2.1.20",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz",
|
||||
"integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==",
|
||||
"requires": {
|
||||
"mime-db": "1.35.0"
|
||||
"mime-db": "1.36.0"
|
||||
}
|
||||
},
|
||||
"mimic-fn": {
|
||||
|
@ -6193,7 +6237,7 @@
|
|||
"debug": "2.6.9",
|
||||
"escape-html": "1.0.3",
|
||||
"http-errors": "1.6.3",
|
||||
"mime-types": "2.1.19",
|
||||
"mime-types": "2.1.20",
|
||||
"parseurl": "1.3.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"clean": "rimraf dist",
|
||||
"pretty": "npx prettier --write \"src/*.js\"",
|
||||
"lint": "eslint --fix \"src/*.js\"",
|
||||
"watch": "npx webpack --watch",
|
||||
"watch": "rollup -w -c rollup.js -o dist/browser.js -f iife -n freesewing_patterns_aaron --footer 'freesewing.patterns.aaron = freesewing_patterns_aaron;'",
|
||||
"browserbuild": "rollup -c rollup.js -o dist/browser.js -f iife -n freesewing_patterns_aaron --footer 'freesewing.patterns.aaron = freesewing_patterns_aaron;'",
|
||||
"nodebuild": "rollup -c rollup.js -o dist/index.js -f cjs",
|
||||
"modulebuild": "rollup -c rollup.js -o dist/index.mjs -f es",
|
||||
|
@ -46,9 +46,9 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@freesewing/brian": "0.6.6",
|
||||
"@freesewing/plugin-bundle": "0.0.1",
|
||||
"freesewing": "^0.6.2"
|
||||
"@freesewing/brian": "0.7.3",
|
||||
"@freesewing/plugin-bundle": "0.1.6",
|
||||
"freesewing": "0.10.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.56",
|
||||
|
|
|
@ -1,57 +1,84 @@
|
|||
import freesewing from "freesewing";
|
||||
import * as shared from "./shared";
|
||||
import { dimensions } from './shared';
|
||||
|
||||
var back = {
|
||||
draft: function(part) {
|
||||
// prettier-ignore
|
||||
let {store, sa, points, Path, paths, Snippet, snippets, final, paperless, macro} = part.shorthand();
|
||||
let {store, sa, Point, points, Path, paths, Snippet, snippets, options, final, paperless, macro, utils, units} = part.shorthand();
|
||||
|
||||
points.strapLeftCp2 = utils.beamsIntersect(
|
||||
points.strapLeft,
|
||||
points.strapCenter.rotate(90, points.strapLeft),
|
||||
points.cbNeck,
|
||||
points.cbNeck.shift(0,10)
|
||||
);
|
||||
|
||||
points.armholeCp2 = points.aaronArmhole.shiftFractionTowards(points.armholeCorner, options.backlineBend);
|
||||
points.strapRightCp1 = points.strapRight.shiftFractionTowards(points.armholeCorner, options.backlineBend);
|
||||
|
||||
// Seamline
|
||||
paths.seam = shared.seamLine("back", points, Path);
|
||||
|
||||
// Store lengths to fit sleeve
|
||||
store.set("backArmholeLength", shared.armholeLength(points, Path));
|
||||
store.set(
|
||||
"backShoulderToArmholePitch",
|
||||
shared.shoulderToArmholePitch(points, Path)
|
||||
);
|
||||
paths.seam = new Path()
|
||||
.move(points.cbNeck)
|
||||
.line(points.cbHips)
|
||||
.line(points.hips)
|
||||
.line(points.waist)
|
||||
.join(paths.side)
|
||||
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
|
||||
.line(points.strapLeft)
|
||||
.curve(points.strapLeftCp2, points.cbNeck, points.cbNeck)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
|
||||
// Final?
|
||||
if (final) {
|
||||
let neckOpeningLength = new Path()
|
||||
.move(points.strapLeft)
|
||||
.curve(points.strapLeftCp2, points.cbNeck, points.cbNeck)
|
||||
.length() + store.get('frontNeckOpeningLength');
|
||||
let armholeLength = new Path()
|
||||
.move(points.aaronArmhole)
|
||||
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
|
||||
.length() + store.get('frontArmholeLength');
|
||||
points.bindinAnchor = new Point(points.aaronArmhole.x / 4, points.aaronArmhole.y)
|
||||
.attr('data-text', 'cutTwoStripsToFinishTheArmholes')
|
||||
.attr('data-text', ":\n")
|
||||
.attr('data-text', "width")
|
||||
.attr('data-text', ":")
|
||||
.attr('data-text', units(sa*6))
|
||||
.attr('data-text', "\n")
|
||||
.attr('data-text', "length")
|
||||
.attr('data-text', ":")
|
||||
.attr('data-text', units(armholeLength * 0.95 + 2*sa))
|
||||
.attr('data-text', "\n \n")
|
||||
.attr('data-text', 'cutOneStripToFinishTheNeckOpening')
|
||||
.attr('data-text', ":\n")
|
||||
.attr('data-text', "width")
|
||||
.attr('data-text', ":")
|
||||
.attr('data-text', units(sa*6))
|
||||
.attr('data-text', "\n")
|
||||
.attr('data-text', "length")
|
||||
.attr('data-text', ":")
|
||||
.attr('data-text', units(neckOpeningLength * 0.95 + 2*sa))
|
||||
.attr('data-text-lineheight', 6);
|
||||
|
||||
macro("cutonfold", {
|
||||
from: points.cbNeck,
|
||||
to: points.cbHips,
|
||||
from: points.cfNeck,
|
||||
to: points.cfHips,
|
||||
grainline: true
|
||||
});
|
||||
|
||||
macro("title", { at: points.title, nr: 2, title: "back" });
|
||||
snippets.armholePitchNotch = new Snippet("bnotch", points.armholePitch);
|
||||
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||
points.scaleboxAnchor = points.scalebox = points.title.shift(90, 100);
|
||||
macro("scalebox", { at: points.scalebox });
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
shared.dimensions(macro, points, Path, sa);
|
||||
macro("hd", {
|
||||
from: points.cbHips,
|
||||
to: points.hips,
|
||||
y: points.hips.y + sa + 15
|
||||
});
|
||||
dimensions(macro, points, sa);
|
||||
macro("vd", {
|
||||
from: points.cbHips,
|
||||
to: points.cbNeck,
|
||||
x: points.cbHips.x - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.cbNeck,
|
||||
to: points.neck,
|
||||
y: points.neck.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.cbNeck,
|
||||
to: points.shoulder,
|
||||
y: points.neck.y - sa - 30
|
||||
});
|
||||
}
|
||||
|
||||
return part;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//import * as shared from "./shared";
|
||||
import { dimensions } from './shared';
|
||||
|
||||
var front = {
|
||||
draft: function(part) {
|
||||
|
@ -14,7 +14,7 @@ var front = {
|
|||
points[`cb${key}`].x,
|
||||
points[`cb${key}`].y
|
||||
);
|
||||
delete points[`cb${key}`];
|
||||
//delete points[`cb${key}`];
|
||||
}
|
||||
|
||||
// Neckline
|
||||
|
@ -26,7 +26,7 @@ var front = {
|
|||
points.strapCenter = points.neck.shiftFractionTowards(points.shoulder, options.shoulderStrapPlacement);
|
||||
points.strapLeft = points.strapCenter.shiftTowards(points.neck, points.neck.dist(points.shoulder) * options.shoulderStrapWidth);
|
||||
points.strapRight = points.strapLeft.rotate(180, points.strapCenter);
|
||||
points.necklineCorner = utils.beamsCross(
|
||||
points.necklineCorner = utils.beamsIntersect(
|
||||
points.strapLeft,
|
||||
points.strapRight.rotate(-90, points.strapLeft),
|
||||
points.cfNeck.shift(0, points.armholePitch.x/4),
|
||||
|
@ -40,36 +40,55 @@ var front = {
|
|||
points.waist.x = points.hips.x; // Because stretch
|
||||
points.waistCp2 = points.waist.shift(90,points.armhole.dy(points.waist)/2);
|
||||
|
||||
// Armhole drop
|
||||
let side = new Path()
|
||||
.move(points.hips)
|
||||
.line(points.waist)
|
||||
.curve(points.waistCp2, points.armhole, points.armhole);
|
||||
let split = side.intersectsY(points.armhole.y * (1 + options.armholeDrop)).pop();
|
||||
paths.side = side.split(split)[0];
|
||||
paths.side.render = false;
|
||||
points.aaronArmhole = split;
|
||||
|
||||
// Armhole
|
||||
points.armholeCorner = utils.beamsCross(
|
||||
points.armhole,
|
||||
points.armholeCp2,
|
||||
points.armholeCorner = utils.beamsIntersect(
|
||||
points.aaronArmhole,
|
||||
points.aaronArmhole.shift(180,10),
|
||||
points.strapRight,
|
||||
points.strapLeft.rotate(90, points.strapRight)
|
||||
);
|
||||
points.armholeCp2 = points.armhole.shiftFractionTowards(points.armholeCorner, 0.8);
|
||||
points.armholeCp2 = points.aaronArmhole.shiftFractionTowards(points.armholeCorner, 0.8);
|
||||
points.strapRightCp1 = points.strapRight.shiftFractionTowards(points.armholeCorner, 0.6);
|
||||
|
||||
// Armhole drop
|
||||
|
||||
|
||||
console.log('cfneck', points.cfNeck);
|
||||
console.log(measurements.naturalWaistToHip);
|
||||
console.log(measurements.centerBackNeckToWaist);
|
||||
|
||||
// Seamline
|
||||
paths.seam = new Path()
|
||||
.move(points.cfNeck)
|
||||
.line(points.cfHips)
|
||||
.line(points.hips)
|
||||
.line(points.waist)
|
||||
.curve(points.waistCp2, points.armhole, points.armhole)
|
||||
.join(paths.side)
|
||||
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
|
||||
.line(points.strapLeft)
|
||||
.curve(points.strapLeftCp2, points.cfNeckCp1, points.cfNeck)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
/*
|
||||
|
||||
// Store length of armhole and neck opening
|
||||
store.set(
|
||||
'frontArmholeLength',
|
||||
new Path()
|
||||
.move(points.aaronArmhole)
|
||||
.curve(points.armholeCp2, points.strapRightCp1, points.strapRight)
|
||||
.length()
|
||||
);
|
||||
store.set(
|
||||
'frontNeckOpeningLength',
|
||||
new Path()
|
||||
.move(points.strapLeft)
|
||||
.curve(points.cfNeckCp1, points.cfNeckCp1, points.cfNeck)
|
||||
.length()
|
||||
);
|
||||
|
||||
// Final?
|
||||
if (final) {
|
||||
macro("cutonfold", {
|
||||
|
@ -77,36 +96,46 @@ var front = {
|
|||
to: points.cfHips,
|
||||
grainline: true
|
||||
});
|
||||
points.title = new Point(points.waist.x/2, points.waist.y);
|
||||
macro("title", { at: points.title, nr: 1, title: "front" });
|
||||
snippets.armholePitchNotch = new Snippet("notch", points.armholePitch);
|
||||
if (sa) paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||
points.logo = points.title.shift(-90, 75);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
|
||||
if (sa) {
|
||||
paths.saShoulder = new Path()
|
||||
.move(points.strapRight)
|
||||
.line(points.strapLeft)
|
||||
.offset(sa)
|
||||
.line(points.strapLeft)
|
||||
.attr("class", "fabric sa");
|
||||
paths.saShoulder
|
||||
.move(points.strapRight)
|
||||
.line(paths.saShoulder.start());
|
||||
paths.saSide = paths.side
|
||||
.offset(sa)
|
||||
.line(points.aaronArmhole)
|
||||
.attr("class", "fabric sa");
|
||||
paths.saHem = new Path()
|
||||
.move(points.cfHips)
|
||||
.line(points.hips)
|
||||
.offset(sa * 2.5).attr("class", "fabric sa")
|
||||
.line(paths.saSide.start());
|
||||
paths.saHem
|
||||
.move(points.cfHips)
|
||||
.line(paths.saHem.start());
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
shared.dimensions(macro, points, Path, sa);
|
||||
macro("hd", {
|
||||
from: points.cfHips,
|
||||
to: points.hips,
|
||||
y: points.hips.y + sa + 15
|
||||
});
|
||||
dimensions(macro, points, sa);
|
||||
macro("vd", {
|
||||
from: points.cfHips,
|
||||
to: points.cfNeck,
|
||||
x: points.cfHips.x - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.cfNeck,
|
||||
to: points.neck,
|
||||
y: points.neck.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.cfNeck,
|
||||
to: points.shoulder,
|
||||
y: points.neck.y - sa - 30
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
return part;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,8 +13,13 @@ var pattern = new freesewing.Pattern({ version: version, ...config })
|
|||
|
||||
pattern.draft = function() {
|
||||
this.parts.base = this.draftBase(new pattern.Part());
|
||||
this.parts.front = this.draftFront(new pattern.Part().copy(this.parts.base));
|
||||
//this.parts.back = this.draftBack(this);
|
||||
if (!this.needs("base", true)) this.parts.base.render = false;
|
||||
if (this.needs(["back", "front"])) {
|
||||
this.parts.front = this.draftFront(new pattern.Part().copy(this.parts.base));
|
||||
}
|
||||
if (this.needs(["back"])) {
|
||||
this.parts.back = this.draftBack(new pattern.Part().copy(this.parts.front));
|
||||
}
|
||||
|
||||
return pattern;
|
||||
};
|
||||
|
|
|
@ -1,91 +1,37 @@
|
|||
export function seamLine(side, points, Path) {
|
||||
let path = new Path();
|
||||
if (side === "back") {
|
||||
path.move(points.cbNeck);
|
||||
path.line(points.cbHips);
|
||||
} else {
|
||||
path.move(points.cfNeck);
|
||||
path.line(points.cfHips);
|
||||
}
|
||||
path
|
||||
.line(points.hips)
|
||||
.line(points.armhole)
|
||||
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
|
||||
.curve(
|
||||
points.armholeHollowCp1,
|
||||
points.armholeHollowCp2,
|
||||
points.armholePitch
|
||||
)
|
||||
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
|
||||
.line(points.neck);
|
||||
if (side === "back") {
|
||||
path.curve(points.neckCp1, points.cbNeck, points.cbNeck);
|
||||
} else {
|
||||
path.curve(points.neckCp1, points.neckCp2, points.cfNeck);
|
||||
}
|
||||
path.close().attr("class", "fabric");
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
export function armholeLength(points, Path) {
|
||||
return new Path()
|
||||
.move(points.armhole)
|
||||
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
|
||||
.curve(
|
||||
points.armholeHollowCp1,
|
||||
points.armholeHollowCp2,
|
||||
points.armholePitch
|
||||
)
|
||||
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
|
||||
.length();
|
||||
}
|
||||
|
||||
export function shoulderToArmholePitch(points, Path) {
|
||||
return new Path()
|
||||
.move(points.armholePitch)
|
||||
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder)
|
||||
.length();
|
||||
}
|
||||
|
||||
export function dimensions(macro, points, Path, sa) {
|
||||
macro("pd", {
|
||||
path: new Path()
|
||||
.move(points.armhole)
|
||||
.curve(points.armholeCp1, points.armholeCp2, points.armholeHollow)
|
||||
.curve(
|
||||
points.armholeHollowCp1,
|
||||
points.armholeHollowCp2,
|
||||
points.armholePitch
|
||||
)
|
||||
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder),
|
||||
d: sa + 15
|
||||
export function dimensions(macro, points, sa) {
|
||||
macro("hd", {
|
||||
from: points.cfHips,
|
||||
to: points.hips,
|
||||
y: points.hips.y + sa * 2.5 + 15
|
||||
});
|
||||
macro("pd", {
|
||||
path: new Path()
|
||||
.move(points.armholePitch)
|
||||
.curve(points.armholePitchCp1, points.armholePitchCp2, points.shoulder),
|
||||
d: -15
|
||||
macro("hd", {
|
||||
from: points.cfNeck,
|
||||
to: points.strapLeft,
|
||||
y: points.neck.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.cfNeck,
|
||||
to: points.strapRight,
|
||||
y: points.neck.y - sa - 30
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.hips,
|
||||
to: points.armhole,
|
||||
x: points.hips.x + sa + 15
|
||||
to: points.aaronArmhole,
|
||||
x: points.aaronArmhole.x + sa + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.hips,
|
||||
to: points.armholePitch,
|
||||
x: points.hips.x + sa + 30
|
||||
to: points.strapRight,
|
||||
x: points.aaronArmhole.x + sa + 30
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.hips,
|
||||
to: points.shoulder,
|
||||
x: points.hips.x + sa + 45
|
||||
to: points.strapLeft,
|
||||
x: points.aaronArmhole.x + sa + 45
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.hips,
|
||||
to: points.neck,
|
||||
x: points.hips.x + sa + 60
|
||||
macro("hd", {
|
||||
from: points.cfNeck,
|
||||
to: points.aaronArmhole,
|
||||
y: points.neck.y - sa - 45
|
||||
});
|
||||
macro("ld", { from: points.neck, to: points.shoulder, d: sa + 15 });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue