tada: Initial commit
This commit is contained in:
parent
c06b3e9587
commit
16751b8afe
17 changed files with 7195 additions and 1 deletions
13
packages/sven/.editorconfig
Normal file
13
packages/sven/.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
# editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
63
packages/sven/.gitignore
vendored
Normal file
63
packages/sven/.gitignore
vendored
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
*.php
|
||||||
|
dist
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
2
packages/sven/.npmignore
Normal file
2
packages/sven/.npmignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
src
|
||||||
|
.editorconfig
|
21
packages/sven/LICENSE
Normal file
21
packages/sven/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Joost De Cock
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -1,2 +1,27 @@
|
||||||
|
<p align="center">
|
||||||
|
<a title="Go to freesewing.org" href="https://freesewing.org/"><img src="https://freesewing.org/img/logo/black.svg" align="center" width="150px" alt="Freesewing logo"/></a>
|
||||||
|
</p>
|
||||||
|
<h4 align="center"><em> <a title="Go to freesewing.org" href="https://freesewing.org/">freesewing</a></em>
|
||||||
|
<br><sup>a library for made-to-measure sewing patterns</sup>
|
||||||
|
</h4>
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://www.npmjs.com/package/@freesewing/sven"><img src="https://badgen.net/npm/v/@freesewing/sven" alt="Version"></a>
|
||||||
|
<a href="https://www.npmjs.com/package/@freesewing/sven"><img src="https://badgen.net/npm/license/@freesewing/sven" alt="License"></a>
|
||||||
|
<a href="https://gitter.im/freesewing/freesewing"><img src="https://badgen.net/badge/chat/on%20Gitter/cyan" alt="Chat on Gitter"></a>
|
||||||
|
<a href="https://freesewing.org/patrons/join"><img src="https://badgen.net/badge/become/a%20Patron/FF5B77" alt="Become a Patron"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
# sven
|
# sven
|
||||||
Port of the freesewing Sven Sweatshirt pattern to nodejs
|
|
||||||
|
Sven is a [freesewing](https://github.com/freesewing/freesewing) pattern
|
||||||
|
for a straightforward sweater.
|
||||||
|
|
||||||
|
See [freesewing.org/patterns/sven](https://freesewing.org/patterns/sven)
|
||||||
|
for more info and examples.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i --save @freesewing/sven
|
||||||
|
```
|
||||||
|
|
||||||
|
|
85
packages/sven/config/index.js
Normal file
85
packages/sven/config/index.js
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "sven",
|
||||||
|
version,
|
||||||
|
measurements: [
|
||||||
|
"bicepsCircumference",
|
||||||
|
"centerBackNeckToWaist",
|
||||||
|
"chestCircumference",
|
||||||
|
"naturalWaist",
|
||||||
|
"naturalWaistToHip",
|
||||||
|
"neckCircumference",
|
||||||
|
"shoulderSlope",
|
||||||
|
"shoulderToShoulder",
|
||||||
|
"hipsCircumference",
|
||||||
|
"shoulderToWrist",
|
||||||
|
"wristCircumference"
|
||||||
|
],
|
||||||
|
dependencies: {
|
||||||
|
frontBase: "base",
|
||||||
|
backBase: "base",
|
||||||
|
front: "frontBase",
|
||||||
|
back: "backBase",
|
||||||
|
sleeve: ["sleeveBase", "front", "back"]
|
||||||
|
},
|
||||||
|
inject: {
|
||||||
|
frontBase: "base",
|
||||||
|
backBase: "base",
|
||||||
|
front: "frontBase",
|
||||||
|
back: "backBase",
|
||||||
|
sleeve: "sleeveBase"
|
||||||
|
},
|
||||||
|
parts: ["cuff", "waistband"],
|
||||||
|
hide: ["base", "frontBase", "backBase", "sleeveBase"],
|
||||||
|
options: {
|
||||||
|
// Constants
|
||||||
|
collarFactor: 5,
|
||||||
|
brianFitSleeve: true,
|
||||||
|
brianFitCollar: true,
|
||||||
|
|
||||||
|
// Booleans
|
||||||
|
ribbing: { bool: true },
|
||||||
|
|
||||||
|
// Percentages
|
||||||
|
acrossBackFactor: { pct: 97, min: 93, max: 100 },
|
||||||
|
chestEase: { pct: 8, min: -4, max: 20 },
|
||||||
|
bicepsEase: { pct: 15, min: 0, max: 50 },
|
||||||
|
cuffEase: { pct: 20, min: 0, max: 30 },
|
||||||
|
collarEase: { pct: 10, min: 5, max: 30 },
|
||||||
|
lengthBonus: { pct: 15, min: 0, max: 60 },
|
||||||
|
sleeveLengthBonus: { pct: 0, min: -40, max: 10 },
|
||||||
|
ribbingHeight: { pct: 8, min: 3, max: 15 },
|
||||||
|
ribbingStretch: { pct: 15, min: 0, max: 30 },
|
||||||
|
|
||||||
|
armholeDepthFactor: { pct: 55, min: 50, max: 70 },
|
||||||
|
backNeckCutout: { pct: 5, min: 2, max: 8 },
|
||||||
|
|
||||||
|
frontArmholeDeeper: { pct: 0, min: 0, max: 1.5 },
|
||||||
|
|
||||||
|
hipsEase: { pct: 8, min: -4, max: 20 },
|
||||||
|
|
||||||
|
shoulderEase: { pct: 0, min: -2, max: 6 },
|
||||||
|
|
||||||
|
shoulderSlopeReduction: { pct: 0, min: 0, max: 8 },
|
||||||
|
sleevecapEase: { pct: 0, min: 0, max: 10 },
|
||||||
|
sleevecapBackFactorX: { pct: 60, min: 35, max: 65 },
|
||||||
|
sleevecapBackFactorY: { pct: 33, min: 35, max: 65 },
|
||||||
|
sleevecapFrontFactorX: { pct: 55, min: 35, max: 65 },
|
||||||
|
sleevecapFrontFactorY: { pct: 33, min: 35, max: 65 },
|
||||||
|
sleevecapQ1Offset: { pct: 3, min: 0, max: 7 },
|
||||||
|
sleevecapQ2Offset: { pct: 5.5, min: 0, max: 7 },
|
||||||
|
sleevecapQ3Offset: { pct: 4.5, min: 0, max: 7 },
|
||||||
|
sleevecapQ4Offset: { pct: 1, min: 0, max: 7 },
|
||||||
|
sleevecapQ1Spread1: { pct: 6, min: 4, max: 20 },
|
||||||
|
sleevecapQ1Spread2: { pct: 15, min: 4, max: 20 },
|
||||||
|
sleevecapQ2Spread1: { pct: 15, min: 4, max: 20 },
|
||||||
|
sleevecapQ2Spread2: { pct: 10, min: 4, max: 20 },
|
||||||
|
sleevecapQ3Spread1: { pct: 10, min: 4, max: 20 },
|
||||||
|
sleevecapQ3Spread2: { pct: 8, min: 4, max: 20 },
|
||||||
|
sleevecapQ4Spread1: { pct: 7, min: 4, max: 20 },
|
||||||
|
sleevecapQ4Spread2: { pct: 7, min: 4, max: 20 },
|
||||||
|
sleeveWidthGuarantee: { pct: 90, min: 25, max: 100 },
|
||||||
|
waistEase: { pct: 8, min: -4, max: 20 }
|
||||||
|
}
|
||||||
|
};
|
94
packages/sven/index.html
Normal file
94
packages/sven/index.html
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Sven</title>
|
||||||
|
<style>
|
||||||
|
.two {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 95%;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="svg"></div>
|
||||||
|
<div id="svg1" class="two"></div>
|
||||||
|
<div id="svg2" class="two"></div>
|
||||||
|
<!-- <script type="text/javascript" src="node_modules/freesewing/dist/browser.js"></script> -->
|
||||||
|
<script type="text/javascript" src="../../freesewing/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="node_modules/@freesewing/brian/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="node_modules/@freesewing/plugin-bundle/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="node_modules/@freesewing/plugin-banner/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="dist/browser.js"></script>
|
||||||
|
<!-- <script type="text/javascript" src="node_modules/@freesewing/plugin-theme/dist/browser.js"></script> -->
|
||||||
|
<script type="text/javascript" src="../../plugins/plugin-theme/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="node_modules/@freesewing/plugin-designer/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="node_modules/@freesewing/plugin-debug/dist/browser.js"></script>
|
||||||
|
<!-- <script type="text/javascript" src="node_modules/@freesewing/plugin-validate/dist/browser.js"></script> -->
|
||||||
|
<script type="text/javascript" src="../../plugins/plugin-validate/dist/browser.js"></script>
|
||||||
|
<!-- <script type="text/javascript" src="node_modules/@freesewing/plugin-i18n/dist/browser.js"></script> -->
|
||||||
|
<script type="text/javascript" src="../../plugins/plugin-i18n/dist/browser.js"></script>
|
||||||
|
<script type="text/javascript" src="node_modules/@freesewing/models/dist/browser.js"></script>
|
||||||
|
<script>
|
||||||
|
let settings = {
|
||||||
|
"embed": true,
|
||||||
|
sa: 10,
|
||||||
|
paperless: true,
|
||||||
|
"measurements": {
|
||||||
|
"bicepsCircumference": 335,
|
||||||
|
"centerBackNeckToWaist": 520,
|
||||||
|
"chestCircumference": 1080,
|
||||||
|
"hipsCircumference": 990,
|
||||||
|
"naturalWaist": 925,
|
||||||
|
"naturalWaistToHip": 145,
|
||||||
|
"neckCircumference": 420,
|
||||||
|
"shoulderSlope": 55,
|
||||||
|
"shoulderToElbow": 410,
|
||||||
|
"shoulderToShoulder": 465,
|
||||||
|
"shoulderToWrist": 680,
|
||||||
|
"wristCircumference": 190,
|
||||||
|
"seatCircumference": 1080,
|
||||||
|
"inseam": 910,
|
||||||
|
"seatDepth": 200,
|
||||||
|
"hipsToUpperLeg": 220,
|
||||||
|
"upperLegCircumference": 630,
|
||||||
|
"headCircumference": 590,
|
||||||
|
"naturalWaistToFloor": 1310,
|
||||||
|
"naturalWaistToSeat": 280
|
||||||
|
},
|
||||||
|
//only: ["front", "frontLeft"],
|
||||||
|
options: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var pattern = new freesewing.patterns.sven(settings);
|
||||||
|
pattern.use(freesewing.plugins.theme);
|
||||||
|
pattern.use(freesewing.plugins.designer);
|
||||||
|
pattern.use(freesewing.plugins.debug);
|
||||||
|
pattern.use(freesewing.plugins.validate);
|
||||||
|
console.log('pattern', pattern);
|
||||||
|
pattern.draft();
|
||||||
|
document.getElementById("svg1").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>
|
||||||
|
</body>
|
||||||
|
</html>
|
6320
packages/sven/package-lock.json
generated
Normal file
6320
packages/sven/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
89
packages/sven/package.json
Normal file
89
packages/sven/package.json
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
{
|
||||||
|
"version": "0.0.1",
|
||||||
|
"name": "@freesewing/sven",
|
||||||
|
"description": "Freesewing pattern for a straightforward sweater",
|
||||||
|
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
|
||||||
|
"license": "MIT",
|
||||||
|
"homepage": "https://github.com/freesewing/sven#readme",
|
||||||
|
"repository": "github:freesewing/sven",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/freesewing/sven/issues"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"freesewing",
|
||||||
|
"pattern",
|
||||||
|
"sewing",
|
||||||
|
"sweater"
|
||||||
|
],
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"module": "dist/index.mjs",
|
||||||
|
"unpkg": "dist/browser.js",
|
||||||
|
"scripts": {
|
||||||
|
"precommit": "npm run pretty && lint-staged",
|
||||||
|
"patch": "npm version patch -m ':bookmark: v%s' && npm run build",
|
||||||
|
"minor": "npm version minor -m ':bookmark: v%s' && npm run build",
|
||||||
|
"major": "npm version major -m ':bookmark: v%s' && npm run build",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"clean": "rimraf dist",
|
||||||
|
"pretty": "npx prettier --write \"src/*.js\" \"config/*.js\"",
|
||||||
|
"lint": "eslint --fix \"src/*.js\"",
|
||||||
|
"watch": "nodemon -w src --exec npm run browserbuild",
|
||||||
|
"browserbuild": "rollup -c rollup.js -o dist/browser.js -f iife -m true -n freesewing_patterns_sven --footer 'freesewing.patterns.sven = freesewing_patterns_sven;'",
|
||||||
|
"nodebuild": "rollup -c rollup.js -o dist/index.js -f cjs -m true",
|
||||||
|
"modulebuild": "rollup -c rollup.js -o dist/index.mjs -f es -m true",
|
||||||
|
"rebuild": "npm run nodebuild && npm run modulebuild",
|
||||||
|
"build": "npm run clean && npm run browserbuild && npm run nodebuild && npm run modulebuild"
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "lint-staged"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,json}": [
|
||||||
|
"prettier --write",
|
||||||
|
"git add"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@freesewing/brian": "^0.22.2",
|
||||||
|
"@freesewing/plugin-banner": "0.2.0",
|
||||||
|
"@freesewing/plugin-bundle": "^0.7.1",
|
||||||
|
"freesewing": "^0.27.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.2.2",
|
||||||
|
"@babel/preset-env": "^7.2.3",
|
||||||
|
"@babel/register": "^7.0.0",
|
||||||
|
"@babel/plugin-proposal-object-rest-spread": "7.2.0",
|
||||||
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
||||||
|
"babel-eslint": "^8.2.6",
|
||||||
|
"@freesewing/antman": "0.2.0",
|
||||||
|
"@freesewing/models": "0.6.0",
|
||||||
|
"@freesewing/plugin-debug": "0.5.2",
|
||||||
|
"@freesewing/plugin-designer": "0.10",
|
||||||
|
"@freesewing/plugin-theme": "0.13.2",
|
||||||
|
"@freesewing/plugin-validate": "0.2.0",
|
||||||
|
"@freesewing/plugin-i18n": "0.0.1",
|
||||||
|
"eslint": "5.10.0",
|
||||||
|
"eslint-config-prettier": "^3.3.0",
|
||||||
|
"eslint-plugin-prettier": "^3.0.0",
|
||||||
|
"husky": "^1.2.1",
|
||||||
|
"lint-staged": "^8.1.0",
|
||||||
|
"prettier": "1.15.3",
|
||||||
|
"rimraf": "^2.6.2",
|
||||||
|
"rollup": "^0.68.1",
|
||||||
|
"rollup-plugin-babel": "^4.1.0",
|
||||||
|
"rollup-plugin-commonjs": "9.2.0",
|
||||||
|
"rollup-plugin-filesize": "^5.0.1",
|
||||||
|
"rollup-plugin-json": "^3.1.0",
|
||||||
|
"rollup-plugin-node-resolve": "^4.0.0",
|
||||||
|
"rollup-plugin-terser": "^3.0.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/*",
|
||||||
|
"README.md",
|
||||||
|
"package-lock.json",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
31
packages/sven/rollup.js
Normal file
31
packages/sven/rollup.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
import { terser } from "rollup-plugin-terser";
|
||||||
|
import babel from "rollup-plugin-babel";
|
||||||
|
import resolve from "rollup-plugin-node-resolve";
|
||||||
|
import json from "rollup-plugin-json";
|
||||||
|
import path from "path";
|
||||||
|
import { name, version, description, author, license } from "./package.json";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: "src/index.js",
|
||||||
|
plugins: [
|
||||||
|
resolve({
|
||||||
|
browser: true
|
||||||
|
}),
|
||||||
|
json(),
|
||||||
|
babel({
|
||||||
|
exclude: "node_modules/**"
|
||||||
|
})
|
||||||
|
//terser({
|
||||||
|
// output: {
|
||||||
|
// preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||||
|
// }
|
||||||
|
//})
|
||||||
|
],
|
||||||
|
external: ["freesewing", "@freesewing/plugin-bundle"],
|
||||||
|
output: {
|
||||||
|
globals: {
|
||||||
|
freesewing: "freesewing",
|
||||||
|
"@freesewing/plugin-bundle": "freesewing.plugins.bundle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
44
packages/sven/src/cuff.js
Normal file
44
packages/sven/src/cuff.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import { draftRibbing } from "./shared";
|
||||||
|
|
||||||
|
export default part => {
|
||||||
|
let {
|
||||||
|
store,
|
||||||
|
measurements,
|
||||||
|
utils,
|
||||||
|
sa,
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
complete,
|
||||||
|
paperless,
|
||||||
|
macro,
|
||||||
|
options
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
if (!options.ribbing) return part;
|
||||||
|
let length =
|
||||||
|
measurements.wristCircumference *
|
||||||
|
(1 + options.cuffEase) *
|
||||||
|
(1 - options.ribbingStretch);
|
||||||
|
draftRibbing(part, length);
|
||||||
|
|
||||||
|
// Complete pattern?
|
||||||
|
if (complete) {
|
||||||
|
macro("title", {
|
||||||
|
at: points.title,
|
||||||
|
nr: 5,
|
||||||
|
title: "cuff"
|
||||||
|
});
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
};
|
33
packages/sven/src/front.js
Normal file
33
packages/sven/src/front.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import { frontBackShared } from "./shared";
|
||||||
|
|
||||||
|
export default part => {
|
||||||
|
frontBackShared(part);
|
||||||
|
let {
|
||||||
|
store,
|
||||||
|
measurements,
|
||||||
|
utils,
|
||||||
|
sa,
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
complete,
|
||||||
|
paperless,
|
||||||
|
macro,
|
||||||
|
options
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
// Complete pattern?
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
};
|
43
packages/sven/src/index.js
Normal file
43
packages/sven/src/index.js
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import freesewing from "freesewing";
|
||||||
|
import Brian from "@freesewing/brian";
|
||||||
|
import plugins from "@freesewing/plugin-bundle";
|
||||||
|
import config from "../config";
|
||||||
|
// Parts
|
||||||
|
import draftFront from "./front";
|
||||||
|
import draftSleeve from "./sleeve";
|
||||||
|
import draftCuff from "./cuff";
|
||||||
|
import draftWaistband from "./waistband";
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
const Sven = function(settings) {
|
||||||
|
freesewing.Pattern.call(this, config);
|
||||||
|
this.use(plugins).apply(settings);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set up inheritance
|
||||||
|
Sven.prototype = Object.create(freesewing.Pattern.prototype);
|
||||||
|
Sven.prototype.constructor = Sven;
|
||||||
|
|
||||||
|
// Attach per-part draft methods to prototype
|
||||||
|
Sven.prototype.draftBase = function(part) {
|
||||||
|
return new Brian(this.settings).draftBase(part);
|
||||||
|
};
|
||||||
|
Sven.prototype.draftFrontBase = function(part) {
|
||||||
|
return new Brian(this.settings).draftFront(part);
|
||||||
|
};
|
||||||
|
Sven.prototype.draftBackBase = function(part) {
|
||||||
|
return new Brian(this.settings).draftBack(part);
|
||||||
|
};
|
||||||
|
Sven.prototype.draftSleeveBase = function(part) {
|
||||||
|
let brian = new Brian(this.settings);
|
||||||
|
return brian.draftSleeve(brian.draftSleevecap(part));
|
||||||
|
};
|
||||||
|
Sven.prototype.draftFront = draftFront;
|
||||||
|
Sven.prototype.draftBack = draftFront;
|
||||||
|
Sven.prototype.draftSleeve = draftSleeve;
|
||||||
|
Sven.prototype.draftCuff = draftCuff;
|
||||||
|
Sven.prototype.draftWaistband = draftWaistband;
|
||||||
|
|
||||||
|
export default Sven;
|
210
packages/sven/src/shared.js
Normal file
210
packages/sven/src/shared.js
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
export const frontBackShared = function(part) {
|
||||||
|
let {
|
||||||
|
store,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
points,
|
||||||
|
paths,
|
||||||
|
Path,
|
||||||
|
sa,
|
||||||
|
complete,
|
||||||
|
paperless,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
let front = true;
|
||||||
|
if (typeof points.cfHem === "undefined") front = false;
|
||||||
|
|
||||||
|
// Waist shaping
|
||||||
|
points.waist.x = (measurements.naturalWaist * (1 + options.waistEase)) / 4;
|
||||||
|
points.hips.x = (measurements.hipsCircumference * (1 + options.hipsEase)) / 4;
|
||||||
|
points.hem.x = points.hips.x;
|
||||||
|
points.hipsCp2 = points.hips.shift(90, measurements.naturalWaistToHip / 3);
|
||||||
|
points.waistCp1 = points.waist.shift(-90, measurements.naturalWaistToHip / 3);
|
||||||
|
points.waistCp2 = points.waist.shift(
|
||||||
|
90,
|
||||||
|
measurements.centerBackNeckToWaist / 4
|
||||||
|
);
|
||||||
|
|
||||||
|
if (options.ribbing) {
|
||||||
|
// Adapt lengtht for ribbing
|
||||||
|
let ribbingHeight;
|
||||||
|
if (typeof store.get("ribbingHeight") === "undefined") {
|
||||||
|
ribbingHeight =
|
||||||
|
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) *
|
||||||
|
options.ribbingHeight;
|
||||||
|
store.set("ribbingHeight", ribbingHeight);
|
||||||
|
} else ribbingHeight = store.get("ribbingHeight");
|
||||||
|
points.hem = points.hem.shift(90, ribbingHeight);
|
||||||
|
if (front) points.cfHem = points.cfHem.shift(90, ribbingHeight);
|
||||||
|
else points.cbHem = points.cbHem.shift(90, ribbingHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paths
|
||||||
|
paths.saBase = new Path()
|
||||||
|
.move(points.hem)
|
||||||
|
.line(points.hips)
|
||||||
|
.curve(points.hipsCp2, points.waistCp1, points.waist)
|
||||||
|
.curve_(points.waistCp2, points.armhole)
|
||||||
|
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||||
|
.curve(points.armholeHollowCp2, points.armholePitchCp1, points.armholePitch)
|
||||||
|
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder)
|
||||||
|
.line(points.neck);
|
||||||
|
if (front)
|
||||||
|
paths.saBase.curve(points.neckCp2Front, points.cfNeckCp1, points.cfNeck);
|
||||||
|
else paths.saBase.curve_(points.neckCp2, points.cbNeck);
|
||||||
|
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.seam = paths.hemBase.join(paths.saBase);
|
||||||
|
if (front) paths.seam.line(points.cfHem);
|
||||||
|
else paths.seam.line(points.cbHem);
|
||||||
|
paths.seam.attr("class", "fabric");
|
||||||
|
|
||||||
|
// Seam allowance
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
paths.sa = paths.hemBase.offset(sa * 3).join(paths.saBase.offset(sa));
|
||||||
|
if (front) paths.sa.line(points.cfNeck).move(points.cfHem);
|
||||||
|
else paths.sa.line(points.cbNeck).move(points.cbHem);
|
||||||
|
paths.sa.line(paths.sa.start());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless
|
||||||
|
if (paperless) {
|
||||||
|
macro("pd", {
|
||||||
|
path: new Path()
|
||||||
|
.move(points.armhole)
|
||||||
|
.curve(points.armholeCp2, points.armholeHollowCp1, points.armholeHollow)
|
||||||
|
.curve(
|
||||||
|
points.armholeHollowCp2,
|
||||||
|
points.armholePitchCp1,
|
||||||
|
points.armholePitch
|
||||||
|
)
|
||||||
|
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
|
||||||
|
d: sa + 15
|
||||||
|
});
|
||||||
|
macro("pd", {
|
||||||
|
path: new Path()
|
||||||
|
.move(points.armholePitch)
|
||||||
|
.curve(points.armholePitchCp2, points.shoulderCp1, points.shoulder),
|
||||||
|
d: -15
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.hips,
|
||||||
|
to: points.waist,
|
||||||
|
x: points.hips.x + sa + 15
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.hips,
|
||||||
|
to: points.armhole,
|
||||||
|
x: points.hips.x + sa + 30
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.hips,
|
||||||
|
to: points.armholePitch,
|
||||||
|
x: points.hips.x + sa + 45
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.hips,
|
||||||
|
to: points.shoulder,
|
||||||
|
x: points.hips.x + sa + 60
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.hips,
|
||||||
|
to: points.neck,
|
||||||
|
x: points.hips.x + sa + 75
|
||||||
|
});
|
||||||
|
macro("ld", { from: points.neck, to: points.shoulder, d: sa + 15 });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const draftRibbing = function(part, length) {
|
||||||
|
let {
|
||||||
|
store,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
points,
|
||||||
|
paths,
|
||||||
|
Path,
|
||||||
|
Point,
|
||||||
|
sa,
|
||||||
|
complete,
|
||||||
|
paperless,
|
||||||
|
macro,
|
||||||
|
units
|
||||||
|
} = part.shorthand();
|
||||||
|
if (typeof store.get("ribbingHeight") === "undefined") {
|
||||||
|
store.set(
|
||||||
|
"ribbingHeight",
|
||||||
|
(measurements.centerBackNeckToWaist + measurements.naturalWaistToHip) *
|
||||||
|
options.ribbingHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let height = store.get("ribbingHeight");
|
||||||
|
let gap = 25;
|
||||||
|
let lead = 50;
|
||||||
|
if (length < 125) lead = length / 3;
|
||||||
|
|
||||||
|
points.topLeft = new Point(0, 0);
|
||||||
|
points.topRight = new Point(height * 2, 0);
|
||||||
|
points.leftGapStart = new Point(0, lead);
|
||||||
|
points.rightGapEnd = new Point(points.topRight.x, lead);
|
||||||
|
points.leftGapEnd = new Point(0, lead + gap);
|
||||||
|
points.rightGapStart = new Point(points.topRight.x, lead + gap);
|
||||||
|
points.bottomLeft = new Point(0, gap + 2 * lead);
|
||||||
|
points.bottomRight = new Point(points.topRight.x, gap + 2 * lead);
|
||||||
|
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.rightGapEnd)
|
||||||
|
.line(points.topRight)
|
||||||
|
.line(points.topLeft)
|
||||||
|
.line(points.leftGapStart)
|
||||||
|
.move(points.leftGapEnd)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.rightGapStart)
|
||||||
|
.attr("class", "fabric");
|
||||||
|
|
||||||
|
paths.hint = new Path()
|
||||||
|
.move(points.leftGapStart)
|
||||||
|
.line(points.leftGapEnd)
|
||||||
|
.move(points.rightGapStart)
|
||||||
|
.line(points.rightGapEnd)
|
||||||
|
.attr("class", "fabric dashed");
|
||||||
|
|
||||||
|
if (complete) {
|
||||||
|
points.title = new Point(
|
||||||
|
points.bottomRight.x / 2,
|
||||||
|
points.bottomRight.y / 2
|
||||||
|
);
|
||||||
|
if (sa) {
|
||||||
|
paths.sa = new Path()
|
||||||
|
.move(points.topLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.topRight)
|
||||||
|
.line(points.topLeft)
|
||||||
|
.close()
|
||||||
|
.offset(sa)
|
||||||
|
.attr("class", "fabric sa");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paperless) {
|
||||||
|
macro("vd", {
|
||||||
|
from: points.bottomRight,
|
||||||
|
to: points.topRight,
|
||||||
|
x: points.topRight.x + sa + 15,
|
||||||
|
text: units(length)
|
||||||
|
});
|
||||||
|
macro("hd", {
|
||||||
|
from: points.topLeft,
|
||||||
|
to: points.topRight,
|
||||||
|
y: points.topRight.y - sa - 15
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
75
packages/sven/src/sleeve.js
Normal file
75
packages/sven/src/sleeve.js
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
export default part => {
|
||||||
|
let {
|
||||||
|
store,
|
||||||
|
measurements,
|
||||||
|
utils,
|
||||||
|
sa,
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
complete,
|
||||||
|
paperless,
|
||||||
|
macro,
|
||||||
|
options
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
if (options.ribbing) {
|
||||||
|
let ribbingHeight = store.get("ribbingHeight");
|
||||||
|
points.wristLeft = points.wristLeft.shift(90, ribbingHeight);
|
||||||
|
points.wristRight = points.wristRight.shift(90, ribbingHeight);
|
||||||
|
points.centerWrist = points.centerWrist.shift(90, ribbingHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.wristRight)
|
||||||
|
.line(points.bicepsRight)
|
||||||
|
.join(paths.sleevecap)
|
||||||
|
.line(points.wristLeft)
|
||||||
|
.line(points.wristRight)
|
||||||
|
.close()
|
||||||
|
.attr("class", "fabric");
|
||||||
|
|
||||||
|
// Complete pattern?
|
||||||
|
if (complete) {
|
||||||
|
macro("grainline", {
|
||||||
|
from: points.centerWrist,
|
||||||
|
to: points.grainlineTo
|
||||||
|
});
|
||||||
|
if (sa) {
|
||||||
|
paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
macro("vd", {
|
||||||
|
from: points.wristLeft,
|
||||||
|
to: points.bicepsLeft,
|
||||||
|
x: points.bicepsLeft.x - sa - 15
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.wristLeft,
|
||||||
|
to: points.sleeveTip,
|
||||||
|
x: points.bicepsLeft.x - sa - 30
|
||||||
|
});
|
||||||
|
macro("hd", {
|
||||||
|
from: points.bicepsLeft,
|
||||||
|
to: points.bicepsRight,
|
||||||
|
y: points.sleeveTip.y - sa - 30
|
||||||
|
});
|
||||||
|
macro("hd", {
|
||||||
|
from: points.wristLeft,
|
||||||
|
to: points.wristRight,
|
||||||
|
y: points.wristLeft.y + sa + 30
|
||||||
|
});
|
||||||
|
macro("pd", {
|
||||||
|
path: paths.sleevecap.reverse(),
|
||||||
|
d: -1 * sa - 15
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
};
|
45
packages/sven/src/waistband.js
Normal file
45
packages/sven/src/waistband.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
import { draftRibbing } from "./shared";
|
||||||
|
|
||||||
|
export default part => {
|
||||||
|
let {
|
||||||
|
store,
|
||||||
|
measurements,
|
||||||
|
utils,
|
||||||
|
sa,
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
complete,
|
||||||
|
paperless,
|
||||||
|
macro,
|
||||||
|
options
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
if (!options.ribbing) return part;
|
||||||
|
|
||||||
|
let length =
|
||||||
|
measurements.hipsCircumference *
|
||||||
|
(1 + options.hipsEase) *
|
||||||
|
(1 - options.ribbingStretch);
|
||||||
|
draftRibbing(part, length);
|
||||||
|
|
||||||
|
// Complete pattern?
|
||||||
|
if (complete) {
|
||||||
|
macro("title", {
|
||||||
|
at: points.title,
|
||||||
|
nr: 4,
|
||||||
|
title: "waistband"
|
||||||
|
});
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
};
|
1
packages/sven/todo
Normal file
1
packages/sven/todo
Normal file
|
@ -0,0 +1 @@
|
||||||
|
make cuffbuttonrows a bool
|
Loading…
Add table
Add a link
Reference in a new issue