✨ Added tutorial pattern
This commit is contained in:
parent
a1e9badc2c
commit
7d9e41ec6f
28 changed files with 11984 additions and 0 deletions
107
packages/tutorial/README.md
Normal file
107
packages/tutorial/README.md
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
> **Note**: This is part of version 2 of FreeSewing.
|
||||||
|
> It is a work in progress, and not ready for prime-time yet
|
||||||
|
>
|
||||||
|
> For all questions, please come say hello in [our chatroom on Gitter](https://gitter.im/).
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<br>
|
||||||
|
<a href="https://freesewing.org/">FreeSewing v2</a>
|
||||||
|
</p>
|
||||||
|
<p align="center">A JavaScript library for made-to-measure sewing patterns</p>
|
||||||
|
<p align='center'><a
|
||||||
|
href="https://www.npmjs.com/package/@freesewing/tutorial"
|
||||||
|
title="@freesewing/tutorial on NPM"
|
||||||
|
><img src="https://img.shields.io/npm/v/@freesewing/tutorial.svg"
|
||||||
|
alt="@freesewing/tutorial on NPM"/>
|
||||||
|
</a><a
|
||||||
|
href="https://opensource.org/licenses/MIT"
|
||||||
|
title="License: MIT"
|
||||||
|
><img src="https://img.shields.io/npm/l/@freesewing/tutorial.svg?label=License"
|
||||||
|
alt="License: MIT"/>
|
||||||
|
</a><a
|
||||||
|
href="https://deepscan.io/dashboard#view=project&tid=2114&pid=2993&bid=23256"
|
||||||
|
title="Code quality on DeepScan"
|
||||||
|
><img src="https://deepscan.io/api/teams/2114/projects/2993/branches/23256/badge/grade.svg"
|
||||||
|
alt="Code quality on DeepScan"/>
|
||||||
|
</a><a
|
||||||
|
href="https://github.com/freesewing/freesewing/issues?q=is%3Aissue+is%3Aopen+label%3Apkg%3Atutorial"
|
||||||
|
title="Open issues tagged pkg:tutorial"
|
||||||
|
><img src="https://img.shields.io/github/issues/freesewing/freesewing/pkg:tutorial.svg?label=Issues"
|
||||||
|
alt="Open issues tagged pkg:tutorial"/>
|
||||||
|
</a></p><p align='center'><a
|
||||||
|
href="https://twitter.com/freesewing_org"
|
||||||
|
title="Follow @freesewing_org on Twitter"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-blue.svg?logo=twitter&logoColor=white&logoWidth=15"
|
||||||
|
alt="Follow @freesewing_org on Twitter"/>
|
||||||
|
</a><a
|
||||||
|
href="https://gitter.im/freesewing/freesewing"
|
||||||
|
title="Chat with us on Gitter"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Chat%20with%20us-CA0547.svg?logo=gitter&logoColor=white&logoWidth=15"
|
||||||
|
alt="Chat with us on Gitter"/>
|
||||||
|
</a><a
|
||||||
|
href="https://freesewing.org/patrons/join"
|
||||||
|
title="Become a FreeSewing Patron"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Support%20us-blueviolet.svg?logo=cash-app&logoColor=white&logoWidth=15"
|
||||||
|
alt="Become a FreeSewing Patron"/>
|
||||||
|
</a><a
|
||||||
|
href="https://instagram.com/freesewing_org"
|
||||||
|
title="Follow @freesewing_org on Twitter"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-E4405F.svg?logo=instagram&logoColor=white&logoWidth=15"
|
||||||
|
alt="Follow @freesewing_org on Twitter"/>
|
||||||
|
</a></p>
|
||||||
|
|
||||||
|
# @freesewing/tutorial
|
||||||
|
|
||||||
|
A FreeSewing pattern for a baby bib that's used in our tutorial
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## About FreeSewing 🤔
|
||||||
|
|
||||||
|
Where the world of makers and developers collide, that's where you'll find FreeSewing.
|
||||||
|
|
||||||
|
Our [core library](https://freesewing.dev/en/freesewing) is a *batteries-included* toolbox
|
||||||
|
for parametric design of sewing patterns. It's a modular system (check our list
|
||||||
|
of [plugins](https://freesewing.dev/en/plugins) and getting started is as simple as:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm init freesewing-pattern
|
||||||
|
```
|
||||||
|
|
||||||
|
The [getting started] section on [freesewing.dev](https://freesewing.dev/) is a good
|
||||||
|
entrypoint to our documentation, but you'll find a lot more there, including
|
||||||
|
our [API documentation](https://freesewing.dev/en/freesewing/api),
|
||||||
|
as well as [examples](https://freesewing.dev/en/freesewing/examples),
|
||||||
|
and [best practices](https://freesewing.dev/en/do).
|
||||||
|
|
||||||
|
If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate
|
||||||
|
our sewing patterns adapted to your measurements.
|
||||||
|
|
||||||
|
## Support FreeSewing: Become a patron 🥰
|
||||||
|
|
||||||
|
FreeSewing is an open source project run by a community,
|
||||||
|
and financially supported by our patrons.
|
||||||
|
|
||||||
|
If you feel what we do is worthwhile, you too
|
||||||
|
should [become a patron](https://freesewing.org/patrons/join).
|
||||||
|
|
||||||
|
## Links 👩💻
|
||||||
|
|
||||||
|
- 💻 Makers website: [freesewing.org](https://freesewing.org)
|
||||||
|
- 💻 Developers website: [freesewing.dev](https://freesewing.org)
|
||||||
|
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/freesewing)
|
||||||
|
- 🐦 Twitter: [@freesewing_org](https://twitter.com/freesewing_org)
|
||||||
|
- 📷 Instagram: [@freesewing_org](https://instagram.com/freesewing_org)
|
||||||
|
|
||||||
|
## License: MIT 🤓
|
||||||
|
|
||||||
|
© [Joost De Cock](https://github.com/joostdecock).
|
||||||
|
See [the license file](https://github.com/freesewing/freesewing/blob/develop/LICENSE) for details.
|
||||||
|
|
||||||
|
## Where to get help 🤯
|
||||||
|
|
||||||
|
Our [chatroom on Gitter](https://gitter.im) is the best place to ask questions,
|
||||||
|
share your feedback, or just hang out.
|
||||||
|
|
||||||
|
If you want to report a problem, please [create an issue](https://github.com/freesewing/freesewing/issues/new).
|
57
packages/tutorial/config/index.js
Normal file
57
packages/tutorial/config/index.js
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
import { version } from "../package.json";
|
||||||
|
|
||||||
|
// ?? 🤔 ?? --> https://en.freesewing.dev/packages/core/config
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "tutorial",
|
||||||
|
version,
|
||||||
|
design: "joostdecock",
|
||||||
|
code: "joostdecock",
|
||||||
|
department: "womenswear",
|
||||||
|
type: "pattern",
|
||||||
|
difficulty: 1,
|
||||||
|
tags: [
|
||||||
|
"freesewing",
|
||||||
|
"design",
|
||||||
|
"diy",
|
||||||
|
"fashion",
|
||||||
|
"made to measure",
|
||||||
|
"parametric design",
|
||||||
|
"pattern",
|
||||||
|
"sewing",
|
||||||
|
"sewing pattern"
|
||||||
|
],
|
||||||
|
optionGroups: {
|
||||||
|
fit: ["neckRatio", "widthRatio", "lengthRatio"],
|
||||||
|
box: ["size"]
|
||||||
|
},
|
||||||
|
measurements: ["headCircumference"],
|
||||||
|
dependencies: {
|
||||||
|
step4: "step3",
|
||||||
|
step5: "step4",
|
||||||
|
step6: "step5",
|
||||||
|
step7: "step6",
|
||||||
|
step8: "step7",
|
||||||
|
step9: "step8",
|
||||||
|
step10: "step9",
|
||||||
|
step11: "step10"
|
||||||
|
},
|
||||||
|
inject: {
|
||||||
|
step4: "step3",
|
||||||
|
step5: "step4",
|
||||||
|
step6: "step5",
|
||||||
|
step7: "step6",
|
||||||
|
step8: "step7",
|
||||||
|
step9: "step8",
|
||||||
|
step10: "step9",
|
||||||
|
step11: "step10"
|
||||||
|
},
|
||||||
|
hide: [],
|
||||||
|
parts: ["step1", "step2", "bib"],
|
||||||
|
options: {
|
||||||
|
size: { pct: 50, min: 10, max: 100 },
|
||||||
|
neckRatio: { pct: 80, min: 70, max: 90 },
|
||||||
|
widthRatio: { pct: 45, min: 35, max: 55 },
|
||||||
|
lengthRatio: { pct: 75, min: 55, max: 85 }
|
||||||
|
}
|
||||||
|
};
|
10
packages/tutorial/example/.babelrc
Normal file
10
packages/tutorial/example/.babelrc
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
["prismjs", {
|
||||||
|
"languages": ["javascript", "css", "markup"],
|
||||||
|
"plugins": ["line-numbers"],
|
||||||
|
"theme": "twilight",
|
||||||
|
"css": true
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
96
packages/tutorial/example/README.md
Normal file
96
packages/tutorial/example/README.md
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
<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>
|
||||||
|
<br>
|
||||||
|
<a href="https://freesewing.org/">FreeSewing v2</a>
|
||||||
|
</p>
|
||||||
|
<p align="center">A JavaScript library for made-to-measure sewing patterns</p>
|
||||||
|
<p align='center'><a
|
||||||
|
href="https://twitter.com/freesewing_org"
|
||||||
|
title="Follow @freesewing_org on Twitter"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-blue.svg?logo=twitter&logoColor=white&logoWidth=15"
|
||||||
|
alt="Follow @freesewing_org on Twitter"/>
|
||||||
|
</a><a
|
||||||
|
href="https://gitter.im/freesewing/freesewing"
|
||||||
|
title="Chat with us on Gitter"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Chat%20with%20us-CA0547.svg?logo=gitter&logoColor=white&logoWidth=15"
|
||||||
|
alt="Chat with us on Gitter"/>
|
||||||
|
</a><a
|
||||||
|
href="https://freesewing.org/patrons/join"
|
||||||
|
title="Become a FreeSewing Patron"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Support%20us-blueviolet.svg?logo=cash-app&logoColor=white&logoWidth=15"
|
||||||
|
alt="Become a FreeSewing Patron"/>
|
||||||
|
</a><a
|
||||||
|
href="https://instagram.com/freesewing_org"
|
||||||
|
title="Follow @freesewing_org on Twitter"
|
||||||
|
><img src="https://img.shields.io/badge/%F3%A0%80%A0-Follow%20us-E4405F.svg?logo=instagram&logoColor=white&logoWidth=15"
|
||||||
|
alt="Follow @freesewing_org on Twitter"/>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
# tutorial example
|
||||||
|
|
||||||
|
This project was bootstrapped with [Create Freesewing Pattern](https://en.freesewing.dev/create-freesewing-pattern):
|
||||||
|
|
||||||
|
```js
|
||||||
|
npm init freesewing-pattern
|
||||||
|
```
|
||||||
|
|
||||||
|
This example folder is part of the local development environment.
|
||||||
|
It is **not** part of the pattern's source code.
|
||||||
|
|
||||||
|
To run this example, follow these steps:
|
||||||
|
|
||||||
|
- In the folder above this one, run: `yarn start` (or `npm start`)
|
||||||
|
- Then, in new terminal, run the same command in this folder: `yarn start` (or `npm start`)
|
||||||
|
|
||||||
|
This will spin up the development environment, similar to [our online demo](https://tutorial.freesewing.dev/).
|
||||||
|
|
||||||
|
## About FreeSewing 🤔
|
||||||
|
|
||||||
|
Where the world of makers and developers collide, that's where you'll find FreeSewing.
|
||||||
|
|
||||||
|
Our [core library](https://freesewing.dev/en/freesewing) is a *batteries-included* toolbox
|
||||||
|
for parametric design of sewing patterns. It's a modular system (check our list
|
||||||
|
of [plugins](https://freesewing.dev/en/plugins) and getting started is as simple as:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm init freesewing-pattern
|
||||||
|
```
|
||||||
|
|
||||||
|
The [getting started] section on [freesewing.dev](https://freesewing.dev/) is a good
|
||||||
|
entrypoint to our documentation, but you'll find a lot more there, including
|
||||||
|
our [API documentation](https://freesewing.dev/en/freesewing/api),
|
||||||
|
as well as [examples](https://freesewing.dev/en/freesewing/examples),
|
||||||
|
and [best practices](https://freesewing.dev/en/do).
|
||||||
|
|
||||||
|
If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate
|
||||||
|
our sewing patterns adapted to your measurements.
|
||||||
|
|
||||||
|
## Support FreeSewing: Become a patron 🥰
|
||||||
|
|
||||||
|
FreeSewing is an open source project run by a community,
|
||||||
|
and financially supported by our patrons.
|
||||||
|
|
||||||
|
If you feel what we do is worthwhile, you too
|
||||||
|
should [become a patron](https://freesewing.org/patrons/join).
|
||||||
|
|
||||||
|
## Links 👩💻
|
||||||
|
|
||||||
|
- 💻 Makers website: [freesewing.org](https://freesewing.org)
|
||||||
|
- 💻 Developers website: [freesewing.dev](https://freesewing.org)
|
||||||
|
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/freesewing)
|
||||||
|
- 🐦 Twitter: [@freesewing_org](https://twitter.com/freesewing_org)
|
||||||
|
- 📷 Instagram: [@freesewing_org](https://instagram.com/freesewing_org)
|
||||||
|
|
||||||
|
## License: MIT 🤓
|
||||||
|
|
||||||
|
© [Joost De Cock](https://github.com/joostdecock).
|
||||||
|
See [the license file](https://github.com/freesewing/freesewing/blob/develop/LICENSE) for details.
|
||||||
|
|
||||||
|
## Where to get help 🤯
|
||||||
|
|
||||||
|
Our [chatroom on Gitter](https://gitter.im) is the best place to ask questions,
|
||||||
|
share your feedback, or just hang out.
|
||||||
|
|
||||||
|
If you want to report a problem, please [create an issue](https://github.com/freesewing/freesewing/issues/new).
|
||||||
|
|
46
packages/tutorial/example/package.json
Normal file
46
packages/tutorial/example/package.json
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"name": "tutorial-example",
|
||||||
|
"homepage": "https://freesewing.github.io/tutorial",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@freesewing/components": "beta",
|
||||||
|
"@freesewing/core": "beta",
|
||||||
|
"@freesewing/css-theme": "beta",
|
||||||
|
"@freesewing/i18n": "beta",
|
||||||
|
"@freesewing/models": "beta",
|
||||||
|
"@freesewing/mui-theme": "beta",
|
||||||
|
"@freesewing/pattern-info": "beta",
|
||||||
|
"@freesewing/plugin-bundle": "beta",
|
||||||
|
"@freesewing/plugin-i18n": "beta",
|
||||||
|
"@freesewing/plugin-svgattr": "beta",
|
||||||
|
"@freesewing/utils": "beta",
|
||||||
|
"@material-ui/core": "^4.0.1",
|
||||||
|
"@material-ui/icons": "^4.0.1",
|
||||||
|
"@material-ui/lab": "^v4.0.0-alpha.14",
|
||||||
|
"pattern": "link:..",
|
||||||
|
"prismjs": "1.16.0",
|
||||||
|
"react": "^16.8",
|
||||||
|
"react-dom": "^16.8",
|
||||||
|
"react-scripts": "^3.0.0",
|
||||||
|
"typeface-roboto-condensed": "latest"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "react-scripts start",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": "react-app"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not ie <= 11",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-plugin-prismjs": "1.0.2"
|
||||||
|
}
|
||||||
|
}
|
BIN
packages/tutorial/example/public/favicon.ico
Normal file
BIN
packages/tutorial/example/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
40
packages/tutorial/example/public/index.html
Normal file
40
packages/tutorial/example/public/index.html
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<meta name="theme-color" content="#000000">
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is added to the
|
||||||
|
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<title>tutorial</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
You need to enable JavaScript to run this app.
|
||||||
|
</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
15
packages/tutorial/example/public/manifest.json
Normal file
15
packages/tutorial/example/public/manifest.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"short_name": "tutorial",
|
||||||
|
"name": "tutorial",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
22
packages/tutorial/example/src/App.js
Normal file
22
packages/tutorial/example/src/App.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
import React from "react";
|
||||||
|
import freesewing from "@freesewing/core";
|
||||||
|
import Workbench from "@freesewing/components/Workbench";
|
||||||
|
import "typeface-roboto-condensed";
|
||||||
|
import "@freesewing/css-theme";
|
||||||
|
|
||||||
|
import Pattern from "pattern";
|
||||||
|
|
||||||
|
const App = props => {
|
||||||
|
let instance = new Pattern();
|
||||||
|
let config = instance.config;
|
||||||
|
return (
|
||||||
|
<Workbench
|
||||||
|
freesewing={freesewing}
|
||||||
|
Pattern={Pattern}
|
||||||
|
config={config}
|
||||||
|
userLanguage="en"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default App;
|
11
packages/tutorial/example/src/index.js
Normal file
11
packages/tutorial/example/src/index.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import React from "react";
|
||||||
|
import ReactDOM from "react-dom";
|
||||||
|
import App from "./App";
|
||||||
|
import * as serviceWorker from "./serviceWorker";
|
||||||
|
|
||||||
|
ReactDOM.render(<App />, document.getElementById("root"));
|
||||||
|
|
||||||
|
// If you want your app to work offline and load faster, you can change
|
||||||
|
// unregister() to register() below. Note this comes with some pitfalls.
|
||||||
|
// Learn more about service workers: http://bit.ly/CRA-PWA
|
||||||
|
serviceWorker.unregister();
|
127
packages/tutorial/example/src/serviceWorker.js
Normal file
127
packages/tutorial/example/src/serviceWorker.js
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
// In production, we register a service worker to serve assets from local cache.
|
||||||
|
|
||||||
|
// This lets the app load faster on subsequent visits in production, and gives
|
||||||
|
// it offline capabilities. However, it also means that developers (and users)
|
||||||
|
// will only see deployed updates on the "N+1" visit to a page, since previously
|
||||||
|
// cached resources are updated in the background.
|
||||||
|
|
||||||
|
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
|
||||||
|
// This link also includes instructions on opting out of this behavior.
|
||||||
|
|
||||||
|
const isLocalhost = Boolean(
|
||||||
|
window.location.hostname === "localhost" ||
|
||||||
|
// [::1] is the IPv6 localhost address.
|
||||||
|
window.location.hostname === "[::1]" ||
|
||||||
|
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||||
|
window.location.hostname.match(
|
||||||
|
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
export function register(config) {
|
||||||
|
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
|
||||||
|
// The URL constructor is available in all browsers that support SW.
|
||||||
|
const publicUrl = new URL(process.env.PUBLIC_URL, window.location);
|
||||||
|
if (publicUrl.origin !== window.location.origin) {
|
||||||
|
// Our service worker won't work if PUBLIC_URL is on a different origin
|
||||||
|
// from what our page is served on. This might happen if a CDN is used to
|
||||||
|
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("load", () => {
|
||||||
|
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
|
||||||
|
|
||||||
|
if (isLocalhost) {
|
||||||
|
// This is running on localhost. Let's check if a service worker still exists or not.
|
||||||
|
checkValidServiceWorker(swUrl, config);
|
||||||
|
|
||||||
|
// Add some additional logging to localhost, pointing developers to the
|
||||||
|
// service worker/PWA documentation.
|
||||||
|
navigator.serviceWorker.ready.then(() => {
|
||||||
|
console.log(
|
||||||
|
"This web app is being served cache-first by a service " +
|
||||||
|
"worker. To learn more, visit https://goo.gl/SC7cgQ"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Is not local host. Just register service worker
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function registerValidSW(swUrl, config) {
|
||||||
|
navigator.serviceWorker
|
||||||
|
.register(swUrl)
|
||||||
|
.then(registration => {
|
||||||
|
registration.onupdatefound = () => {
|
||||||
|
const installingWorker = registration.installing;
|
||||||
|
installingWorker.onstatechange = () => {
|
||||||
|
if (installingWorker.state === "installed") {
|
||||||
|
if (navigator.serviceWorker.controller) {
|
||||||
|
// At this point, the old content will have been purged and
|
||||||
|
// the fresh content will have been added to the cache.
|
||||||
|
// It's the perfect time to display a "New content is
|
||||||
|
// available; please refresh." message in your web app.
|
||||||
|
console.log("New content is available; please refresh.");
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config.onUpdate) {
|
||||||
|
config.onUpdate(registration);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// At this point, everything has been precached.
|
||||||
|
// It's the perfect time to display a
|
||||||
|
// "Content is cached for offline use." message.
|
||||||
|
console.log("Content is cached for offline use.");
|
||||||
|
|
||||||
|
// Execute callback
|
||||||
|
if (config.onSuccess) {
|
||||||
|
config.onSuccess(registration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error("Error during service worker registration:", error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkValidServiceWorker(swUrl, config) {
|
||||||
|
// Check if the service worker can be found. If it can't reload the page.
|
||||||
|
fetch(swUrl)
|
||||||
|
.then(response => {
|
||||||
|
// Ensure service worker exists, and that we really are getting a JS file.
|
||||||
|
if (
|
||||||
|
response.status === 404 ||
|
||||||
|
response.headers.get("content-type").indexOf("javascript") === -1
|
||||||
|
) {
|
||||||
|
// No service worker found. Probably a different app. Reload the page.
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister().then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Service worker found. Proceed as normal.
|
||||||
|
registerValidSW(swUrl, config);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
console.log(
|
||||||
|
"No internet connection found. App is running in offline mode."
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function unregister() {
|
||||||
|
if ("serviceWorker" in navigator) {
|
||||||
|
navigator.serviceWorker.ready.then(registration => {
|
||||||
|
registration.unregister();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
10541
packages/tutorial/example/yarn.lock
Normal file
10541
packages/tutorial/example/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
92
packages/tutorial/package.json
Normal file
92
packages/tutorial/package.json
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
{
|
||||||
|
"name": "@freesewing/tutorial",
|
||||||
|
"version": "2.0.0-beta.12",
|
||||||
|
"description": "A FreeSewing pattern for a baby bib that's used in our tutorial",
|
||||||
|
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
|
||||||
|
"homepage": "https://freesewing.org/",
|
||||||
|
"repository": "github:freesewing/freesewing",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/freesewing/freesewing/issues"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"freesewing",
|
||||||
|
"design",
|
||||||
|
"diy",
|
||||||
|
"fashion",
|
||||||
|
"made to measure",
|
||||||
|
"parametric design",
|
||||||
|
"pattern",
|
||||||
|
"sewing",
|
||||||
|
"sewing pattern"
|
||||||
|
],
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"module": "dist/index.mjs",
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf dist",
|
||||||
|
"nodebuild": "BABEL_ENV=production rollup -c -o dist/index.js -f cjs",
|
||||||
|
"modulebuild": "BABEL_ENV=production rollup -c -o dist/index.mjs -f es",
|
||||||
|
"build": "npm run clean && npm run nodebuild && npm run modulebuild",
|
||||||
|
"test": "echo \"tutorial: No tests configured. Perhaps you'd like to do this?\" && exit 0",
|
||||||
|
"pubtest": "npm publish --registry http://localhost:6662",
|
||||||
|
"pubforce": "npm publish",
|
||||||
|
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
|
||||||
|
"start": "rollup -c -w"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@freesewing/core": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/plugin-bundle": "^2.0.0-beta.12"
|
||||||
|
},
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"react": "^16.4.1",
|
||||||
|
"react-dom": "^16.4.1",
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.0.0",
|
||||||
|
"babel-eslint": "10.0.1",
|
||||||
|
"eslint": "^5.16.0",
|
||||||
|
"babel-jest": "24.7.1",
|
||||||
|
"jest": "24.7.1",
|
||||||
|
"@freesewing/components": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/rendertest": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/css-theme": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/i18n": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/mui-theme": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/patterns": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/plugin-bust": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/plugin-buttons": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/plugin-flip": "^2.0.0-beta.12",
|
||||||
|
"@freesewing/utils": "^2.0.0-beta.12",
|
||||||
|
"@svgr/rollup": "^2.4.1",
|
||||||
|
"cross-env": "^5.1.4",
|
||||||
|
"gh-pages": "^1.2.0",
|
||||||
|
"react-scripts": "^3.0.0",
|
||||||
|
"webpack": "4.29.6",
|
||||||
|
"rollup": "^0.64.1",
|
||||||
|
"rollup-plugin-babel": "^4.0.1",
|
||||||
|
"rollup-plugin-babel-minify": "^7.0.0",
|
||||||
|
"rollup-plugin-commonjs": "^9.1.3",
|
||||||
|
"rollup-plugin-json": "^3.1.0",
|
||||||
|
"rollup-plugin-node-resolve": "^3.3.0",
|
||||||
|
"rollup-plugin-peer-deps-external": "^2.2.0",
|
||||||
|
"rollup-plugin-postcss": "^1.6.2",
|
||||||
|
"rollup-plugin-url": "^1.4.0",
|
||||||
|
"@material-ui/core": "3.9.3",
|
||||||
|
"@material-ui/icons": "3.0.2",
|
||||||
|
"@material-ui/lab": "3.0.0-alpha.30",
|
||||||
|
"react-intl": "2.8.0",
|
||||||
|
"prop-types": "15.7.2"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/*",
|
||||||
|
"README.md",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public",
|
||||||
|
"tag": "beta"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0.0",
|
||||||
|
"npm": ">=5"
|
||||||
|
}
|
||||||
|
}
|
56
packages/tutorial/rollup.config.js
Normal file
56
packages/tutorial/rollup.config.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
import babel from "rollup-plugin-babel";
|
||||||
|
import resolve from "rollup-plugin-node-resolve";
|
||||||
|
import commonjs from "rollup-plugin-commonjs";
|
||||||
|
import json from "rollup-plugin-json";
|
||||||
|
import minify from "rollup-plugin-babel-minify";
|
||||||
|
import yaml from "rollup-plugin-yaml";
|
||||||
|
import url from "rollup-plugin-url";
|
||||||
|
import postcss from "rollup-plugin-postcss";
|
||||||
|
import svgr from "@svgr/rollup";
|
||||||
|
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
||||||
|
import {
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
description,
|
||||||
|
author,
|
||||||
|
license,
|
||||||
|
main,
|
||||||
|
module
|
||||||
|
} from "./package.json";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: "src/index.js",
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
file: main,
|
||||||
|
format: "cjs",
|
||||||
|
sourcemap: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
file: module,
|
||||||
|
format: "es",
|
||||||
|
sourcemap: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
peerDepsExternal(),
|
||||||
|
resolve({ modulesOnly: true }),
|
||||||
|
url(),
|
||||||
|
commonjs(),
|
||||||
|
json(),
|
||||||
|
yaml(),
|
||||||
|
svgr(),
|
||||||
|
postcss({
|
||||||
|
modules: true
|
||||||
|
}),
|
||||||
|
babel({
|
||||||
|
exclude: "node_modules/**",
|
||||||
|
plugins: ["@babel/plugin-proposal-object-rest-spread"]
|
||||||
|
}),
|
||||||
|
minify({
|
||||||
|
comments: false,
|
||||||
|
sourceMap: true,
|
||||||
|
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||||
|
})
|
||||||
|
]
|
||||||
|
};
|
5
packages/tutorial/src/.eslintrc
Normal file
5
packages/tutorial/src/.eslintrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
230
packages/tutorial/src/bib.js
Normal file
230
packages/tutorial/src/bib.js
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
macro,
|
||||||
|
complete,
|
||||||
|
snippets,
|
||||||
|
Snippet,
|
||||||
|
paperless
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
// Construct the neck opening
|
||||||
|
let tweak = 1;
|
||||||
|
let target = (measurements.headCircumference * options.neckRatio) / 4;
|
||||||
|
let delta = Infinity;
|
||||||
|
do {
|
||||||
|
points.right = new Point((tweak * measurements.headCircumference) / 10, 0);
|
||||||
|
points.bottom = new Point(0, (tweak * measurements.headCircumference) / 12);
|
||||||
|
|
||||||
|
points.rightCp1 = points.right.shift(
|
||||||
|
90,
|
||||||
|
points.bottom.dy(points.right) / 2
|
||||||
|
);
|
||||||
|
points.bottomCp2 = points.bottom.shift(
|
||||||
|
0,
|
||||||
|
points.bottom.dx(points.right) / 2
|
||||||
|
);
|
||||||
|
|
||||||
|
paths.neck = new Path()
|
||||||
|
.move(points.right)
|
||||||
|
.curve(points.rightCp1, points.bottomCp2, points.bottom);
|
||||||
|
|
||||||
|
delta = paths.neck.length() - target;
|
||||||
|
if (delta > 0) tweak = tweak * 0.99;
|
||||||
|
else tweak = tweak * 1.02;
|
||||||
|
} while (Math.abs(delta) > 1);
|
||||||
|
|
||||||
|
points.rightCp2 = points.rightCp1.flipY();
|
||||||
|
points.bottomCp1 = points.bottomCp2.flipX();
|
||||||
|
|
||||||
|
points.left = points.right.flipX();
|
||||||
|
points.leftCp1 = points.rightCp2.flipX();
|
||||||
|
points.leftCp2 = points.rightCp1.flipX();
|
||||||
|
|
||||||
|
points.top = points.bottom.flipY();
|
||||||
|
points.topCp1 = points.bottomCp2.flipY();
|
||||||
|
points.topCp2 = points.bottomCp1.flipY();
|
||||||
|
|
||||||
|
// Construct the outline
|
||||||
|
let width = measurements.headCircumference * options.widthRatio;
|
||||||
|
let length = measurements.headCircumference * options.lengthRatio;
|
||||||
|
|
||||||
|
points.topLeft = new Point(
|
||||||
|
width / -2,
|
||||||
|
points.top.y - (width / 2 - points.right.x)
|
||||||
|
);
|
||||||
|
points.topRight = points.topLeft.shift(0, width);
|
||||||
|
points.bottomLeft = points.topLeft.shift(-90, length);
|
||||||
|
points.bottomRight = points.topRight.shift(-90, length);
|
||||||
|
|
||||||
|
points.edgeLeft = new Point(points.topLeft.x, points.left.y);
|
||||||
|
points.edgeRight = new Point(points.topRight.x, points.right.y);
|
||||||
|
points.edgeTop = new Point(0, points.topLeft.y);
|
||||||
|
|
||||||
|
points.edgeLeftCp = points.edgeLeft.shiftFractionTowards(points.topLeft, 0.5);
|
||||||
|
points.edgeRightCp = points.edgeLeftCp.flipX();
|
||||||
|
points.edgeTopLeftCp = points.edgeTop.shiftFractionTowards(
|
||||||
|
points.topLeft,
|
||||||
|
0.5
|
||||||
|
);
|
||||||
|
points.edgeTopRightCp = points.edgeTopLeftCp.flipX();
|
||||||
|
|
||||||
|
// Round the end of the straps
|
||||||
|
let strap = points.edgeTop.dy(points.top);
|
||||||
|
|
||||||
|
points.tipRight = points.edgeTop.translate(strap / 2, strap / 2);
|
||||||
|
points.tipRightTop = new Point(points.tipRight.x, points.edgeTop.y);
|
||||||
|
points.tipRightBottom = new Point(points.tipRight.x, points.top.y);
|
||||||
|
|
||||||
|
macro("round", {
|
||||||
|
from: points.edgeTop,
|
||||||
|
to: points.tipRight,
|
||||||
|
via: points.tipRightTop,
|
||||||
|
prefix: "tipRightTop"
|
||||||
|
});
|
||||||
|
macro("round", {
|
||||||
|
from: points.tipRight,
|
||||||
|
to: points.top,
|
||||||
|
via: points.tipRightBottom,
|
||||||
|
prefix: "tipRightBottom"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Rotate straps so they don't overlap
|
||||||
|
let rotateThese = [
|
||||||
|
"edgeTopLeftCp",
|
||||||
|
"edgeTop",
|
||||||
|
"tipRight",
|
||||||
|
"tipRightTop",
|
||||||
|
"tipRightTopStart",
|
||||||
|
"tipRightTopCp1",
|
||||||
|
"tipRightTopCp2",
|
||||||
|
"tipRightTopEnd",
|
||||||
|
"tipRightBottomStart",
|
||||||
|
"tipRightBottomCp1",
|
||||||
|
"tipRightBottomCp2",
|
||||||
|
"tipRightBottomEnd",
|
||||||
|
"tipRightBottom",
|
||||||
|
"top",
|
||||||
|
"topCp2"
|
||||||
|
];
|
||||||
|
|
||||||
|
while (points.tipRightBottomStart.x > -1) {
|
||||||
|
for (let p of rotateThese) points[p] = points[p].rotate(1, points.edgeLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add points to anchor snaps on
|
||||||
|
points.snapLeft = points.top.shiftFractionTowards(points.edgeTop, 0.5);
|
||||||
|
|
||||||
|
// Mirror points to the other side
|
||||||
|
points.edgeTopRightCp = points.edgeTopLeftCp.flipX();
|
||||||
|
points.topCp1 = points.topCp2.flipX();
|
||||||
|
points.tipLeftTopStart = points.tipRightTopStart.flipX();
|
||||||
|
points.tipLeftTopCp1 = points.tipRightTopCp1.flipX();
|
||||||
|
points.tipLeftTopCp2 = points.tipRightTopCp2.flipX();
|
||||||
|
points.tipLeftTopEnd = points.tipRightTopEnd.flipX();
|
||||||
|
points.tipLeftBottomStart = points.tipRightBottomStart.flipX();
|
||||||
|
points.tipLeftBottomCp1 = points.tipRightBottomCp1.flipX();
|
||||||
|
points.tipLeftBottomCp2 = points.tipRightBottomCp2.flipX();
|
||||||
|
points.tipLeftBottomEnd = points.tipRightBottomEnd.flipX();
|
||||||
|
points.snapRight = points.snapLeft.flipX();
|
||||||
|
|
||||||
|
// Round the bottom of the bib
|
||||||
|
// Radius is fixed, but you could use an option for it)
|
||||||
|
macro("round", {
|
||||||
|
from: points.topLeft,
|
||||||
|
to: points.bottomRight,
|
||||||
|
via: points.bottomLeft,
|
||||||
|
radius: points.bottomRight.x / 4,
|
||||||
|
prefix: "bottomLeft"
|
||||||
|
});
|
||||||
|
macro("round", {
|
||||||
|
from: points.bottomLeft,
|
||||||
|
to: points.topRight,
|
||||||
|
via: points.bottomRight,
|
||||||
|
radius: points.bottomRight.x / 4,
|
||||||
|
prefix: "bottomRight"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Construct the path
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.edgeLeft)
|
||||||
|
.line(points.bottomLeftStart)
|
||||||
|
.curve(points.bottomLeftCp1, points.bottomLeftCp2, points.bottomLeftEnd)
|
||||||
|
.line(points.bottomRightStart)
|
||||||
|
.curve(points.bottomRightCp1, points.bottomRightCp2, points.bottomRightEnd)
|
||||||
|
.line(points.edgeRight)
|
||||||
|
.curve(points.edgeRightCp, points.edgeTopRightCp, points.tipLeftTopStart)
|
||||||
|
.curve(points.tipLeftTopCp1, points.tipLeftTopCp2, points.tipLeftTopEnd)
|
||||||
|
.curve(
|
||||||
|
points.tipLeftBottomCp1,
|
||||||
|
points.tipLeftBottomCp2,
|
||||||
|
points.tipLeftBottomEnd
|
||||||
|
)
|
||||||
|
.curve(points.topCp1, points.rightCp2, points.right)
|
||||||
|
.curve(points.rightCp1, points.bottomCp2, points.bottom)
|
||||||
|
.curve(points.bottomCp1, points.leftCp2, points.left)
|
||||||
|
.curve(points.leftCp1, points.topCp2, points.tipRightBottomEnd)
|
||||||
|
.curve(
|
||||||
|
points.tipRightBottomCp2,
|
||||||
|
points.tipRightBottomCp1,
|
||||||
|
points.tipRightBottomStart
|
||||||
|
)
|
||||||
|
.curve(
|
||||||
|
points.tipRightTopCp2,
|
||||||
|
points.tipRightTopCp1,
|
||||||
|
points.tipRightTopStart
|
||||||
|
)
|
||||||
|
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
|
||||||
|
.close()
|
||||||
|
.attr("class", "fabric");
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
// Add the snaps
|
||||||
|
snippets.snapMale = new Snippet("snap-male", points.snapLeft);
|
||||||
|
snippets.snapFemale = new Snippet("snap-female", points.snapRight).attr(
|
||||||
|
"opacity",
|
||||||
|
0.5
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add the bias tape
|
||||||
|
paths.bias = paths.seam
|
||||||
|
.offset(-5)
|
||||||
|
.attr("class", "various dashed")
|
||||||
|
.attr("data-text", "finishWithBiasTape")
|
||||||
|
.attr("data-text-class", "center fill-various");
|
||||||
|
|
||||||
|
// Add the title
|
||||||
|
points.title = points.bottom.shift(-90, 45);
|
||||||
|
macro("title", {
|
||||||
|
at: points.title,
|
||||||
|
nr: 1,
|
||||||
|
title: "bib"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add the scalebox
|
||||||
|
points.scalebox = points.title.shift(-90, 55);
|
||||||
|
macro("scalebox", { at: points.scalebox });
|
||||||
|
|
||||||
|
// Add the logo
|
||||||
|
points.logo = new Point(0, 0);
|
||||||
|
snippets.logo = new Snippet("logo", points.logo);
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
// Add dimensions
|
||||||
|
macro("hd", {
|
||||||
|
from: points.bottomLeftStart,
|
||||||
|
to: points.bottomRightEnd,
|
||||||
|
y: points.bottomLeft - 15
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
35
packages/tutorial/src/index.js
Normal file
35
packages/tutorial/src/index.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import freesewing from "@freesewing/core";
|
||||||
|
import plugins from "@freesewing/plugin-bundle";
|
||||||
|
import config from "../config";
|
||||||
|
import draftBib from "./bib";
|
||||||
|
// Intermediate steps for tutorial
|
||||||
|
import draftStep1 from "./step1";
|
||||||
|
import draftStep2 from "./step2";
|
||||||
|
import draftStep3 from "./step3";
|
||||||
|
import draftStep4 from "./step4";
|
||||||
|
import draftStep5 from "./step5";
|
||||||
|
import draftStep6 from "./step6";
|
||||||
|
import draftStep7 from "./step7";
|
||||||
|
import draftStep8 from "./step8";
|
||||||
|
import draftStep9 from "./step9";
|
||||||
|
import draftStep10 from "./step10";
|
||||||
|
import draftStep11 from "./step11";
|
||||||
|
|
||||||
|
// Create new design
|
||||||
|
const Pattern = new freesewing.Design(config, plugins);
|
||||||
|
|
||||||
|
// Attach the draft methods to the prototype
|
||||||
|
Pattern.prototype.draftBib = draftBib;
|
||||||
|
Pattern.prototype.draftStep1 = draftStep1;
|
||||||
|
Pattern.prototype.draftStep2 = draftStep2;
|
||||||
|
Pattern.prototype.draftStep3 = draftStep3;
|
||||||
|
Pattern.prototype.draftStep4 = draftStep4;
|
||||||
|
Pattern.prototype.draftStep5 = draftStep5;
|
||||||
|
Pattern.prototype.draftStep6 = draftStep6;
|
||||||
|
Pattern.prototype.draftStep7 = draftStep7;
|
||||||
|
Pattern.prototype.draftStep8 = draftStep8;
|
||||||
|
Pattern.prototype.draftStep9 = draftStep9;
|
||||||
|
Pattern.prototype.draftStep10 = draftStep10;
|
||||||
|
Pattern.prototype.draftStep11 = draftStep11;
|
||||||
|
|
||||||
|
export default Pattern;
|
60
packages/tutorial/src/step1.js
Normal file
60
packages/tutorial/src/step1.js
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
options,
|
||||||
|
Point,
|
||||||
|
Path,
|
||||||
|
points,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
complete,
|
||||||
|
sa,
|
||||||
|
paperless,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
let w = 500 * options.size;
|
||||||
|
points.topLeft = new Point(0, 0);
|
||||||
|
points.topRight = new Point(w, 0);
|
||||||
|
points.bottomLeft = new Point(0, w / 2);
|
||||||
|
points.bottomRight = new Point(w, w / 2);
|
||||||
|
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.topLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.topRight)
|
||||||
|
.line(points.topLeft)
|
||||||
|
.close()
|
||||||
|
.attr("class", "fabric");
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
points.logo = points.topLeft.shiftFractionTowards(points.bottomRight, 0.5);
|
||||||
|
snippets.logo = new Snippet("logo", points.logo);
|
||||||
|
points.text = points.logo
|
||||||
|
.shift(-90, w / 8)
|
||||||
|
.attr("data-text", "hello")
|
||||||
|
.attr("data-text-class", "center");
|
||||||
|
|
||||||
|
if (sa) {
|
||||||
|
paths.sa = paths.seam.offset(sa).attr("class", "fabric sa");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
macro("hd", {
|
||||||
|
from: points.bottomLeft,
|
||||||
|
to: points.bottomRight,
|
||||||
|
y: points.bottomLeft.y + sa + 15
|
||||||
|
});
|
||||||
|
macro("vd", {
|
||||||
|
from: points.bottomRight,
|
||||||
|
to: points.topRight,
|
||||||
|
x: points.topRight.x + sa + 15
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
61
packages/tutorial/src/step10.js
Normal file
61
packages/tutorial/src/step10.js
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
macro("round", {
|
||||||
|
from: points.topLeft,
|
||||||
|
to: points.bottomRight,
|
||||||
|
via: points.bottomLeft,
|
||||||
|
radius: points.bottomRight.x / 4,
|
||||||
|
render: true,
|
||||||
|
prefix: "bottomLeft"
|
||||||
|
});
|
||||||
|
macro("round", {
|
||||||
|
from: points.bottomLeft,
|
||||||
|
to: points.topRight,
|
||||||
|
via: points.bottomRight,
|
||||||
|
radius: points.bottomRight.x / 4,
|
||||||
|
render: true,
|
||||||
|
prefix: "bottomRight"
|
||||||
|
});
|
||||||
|
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.edgeLeft)
|
||||||
|
.line(points.bottomLeftStart)
|
||||||
|
.curve(points.bottomLeftCp1, points.bottomLeftCp2, points.bottomLeftEnd)
|
||||||
|
.line(points.bottomRightStart)
|
||||||
|
.curve(points.bottomRightCp1, points.bottomRightCp2, points.bottomRightEnd)
|
||||||
|
.line(points.edgeRight)
|
||||||
|
.curve(points.edgeRightCp, points.edgeTopRightCp, points.tipLeftTopStart)
|
||||||
|
.curve(points.tipLeftTopCp1, points.tipLeftTopCp2, points.tipLeftTopEnd)
|
||||||
|
.curve(
|
||||||
|
points.tipLeftBottomCp1,
|
||||||
|
points.tipLeftBottomCp2,
|
||||||
|
points.tipLeftBottomEnd
|
||||||
|
)
|
||||||
|
.curve(points.topCp1, points.rightCp2, points.right)
|
||||||
|
.curve(points.rightCp1, points.bottomCp2, points.bottom)
|
||||||
|
.curve(points.bottomCp1, points.leftCp2, points.left)
|
||||||
|
.curve(points.leftCp1, points.topCp2, points.tipRightBottomEnd)
|
||||||
|
.curve(
|
||||||
|
points.tipRightBottomCp2,
|
||||||
|
points.tipRightBottomCp1,
|
||||||
|
points.tipRightBottomStart
|
||||||
|
)
|
||||||
|
.curve(
|
||||||
|
points.tipRightTopCp2,
|
||||||
|
points.tipRightTopCp1,
|
||||||
|
points.tipRightTopStart
|
||||||
|
)
|
||||||
|
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
|
||||||
|
.close();
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
48
packages/tutorial/src/step11.js
Normal file
48
packages/tutorial/src/step11.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
macro,
|
||||||
|
complete,
|
||||||
|
snippets,
|
||||||
|
Snippet
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
snippets.snapMale = new Snippet("snap-male", points.snapLeft);
|
||||||
|
snippets.snapFemale = new Snippet("snap-female", points.snapRight).attr(
|
||||||
|
"opacity",
|
||||||
|
0.5
|
||||||
|
);
|
||||||
|
|
||||||
|
paths.bias = paths.seam
|
||||||
|
.offset(-5)
|
||||||
|
.attr("class", "various dashed")
|
||||||
|
.attr("data-text", "finishWithBiasTape")
|
||||||
|
.attr("data-text-class", "center fill-various");
|
||||||
|
|
||||||
|
points.title = points.bottom.shift(-90, 45);
|
||||||
|
macro("title", {
|
||||||
|
at: points.title,
|
||||||
|
nr: 1,
|
||||||
|
title: "bib"
|
||||||
|
});
|
||||||
|
|
||||||
|
points.scalebox = points.title.shift(-90, 55);
|
||||||
|
macro("scalebox", { at: points.scalebox });
|
||||||
|
|
||||||
|
points.logo = new Point(0, 0);
|
||||||
|
snippets.logo = new Snippet("logo", points.logo);
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
15
packages/tutorial/src/step2.js
Normal file
15
packages/tutorial/src/step2.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { Point, points, Path, paths, measurements, options } = part.shorthand();
|
||||||
|
|
||||||
|
points.right = new Point(measurements.headCircumference / 10, 0);
|
||||||
|
points.bottom = new Point(0, measurements.headCircumference / 12);
|
||||||
|
|
||||||
|
points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right) / 2);
|
||||||
|
points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right) / 2);
|
||||||
|
|
||||||
|
paths.neck = new Path()
|
||||||
|
.move(points.right)
|
||||||
|
.curve(points.rightCp1, points.bottomCp2, points.bottom);
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
40
packages/tutorial/src/step3.js
Normal file
40
packages/tutorial/src/step3.js
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { Point, points, Path, paths, measurements, options } = part.shorthand();
|
||||||
|
|
||||||
|
let tweak = 1;
|
||||||
|
let target = (measurements.headCircumference * options.neckRatio) / 4;
|
||||||
|
let delta = Infinity;
|
||||||
|
do {
|
||||||
|
points.right = new Point((tweak * measurements.headCircumference) / 10, 0);
|
||||||
|
points.bottom = new Point(0, (tweak * measurements.headCircumference) / 12);
|
||||||
|
|
||||||
|
points.rightCp1 = points.right.shift(
|
||||||
|
90,
|
||||||
|
points.bottom.dy(points.right) / 2
|
||||||
|
);
|
||||||
|
points.bottomCp2 = points.bottom.shift(
|
||||||
|
0,
|
||||||
|
points.bottom.dx(points.right) / 2
|
||||||
|
);
|
||||||
|
|
||||||
|
paths.neck = new Path()
|
||||||
|
.move(points.right)
|
||||||
|
.curve(points.rightCp1, points.bottomCp2, points.bottom);
|
||||||
|
|
||||||
|
delta = paths.neck.length() - target;
|
||||||
|
if (delta > 0) tweak = tweak * 0.99;
|
||||||
|
else tweak = tweak * 1.02;
|
||||||
|
} while (Math.abs(delta) > 1);
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
34
packages/tutorial/src/step4.js
Normal file
34
packages/tutorial/src/step4.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { Point, points, Path, paths, measurements, options } = part.shorthand();
|
||||||
|
|
||||||
|
points.rightCp2 = points.rightCp1.flipY();
|
||||||
|
points.bottomCp1 = points.bottomCp2.flipX();
|
||||||
|
|
||||||
|
points.left = points.right.flipX();
|
||||||
|
points.leftCp1 = points.rightCp2.flipX();
|
||||||
|
points.leftCp2 = points.rightCp1.flipX();
|
||||||
|
|
||||||
|
points.top = points.bottom.flipY();
|
||||||
|
points.topCp1 = points.bottomCp2.flipY();
|
||||||
|
points.topCp2 = points.bottomCp1.flipY();
|
||||||
|
|
||||||
|
paths.neck = new Path()
|
||||||
|
.move(points.top)
|
||||||
|
.curve(points.topCp2, points.leftCp1, points.left)
|
||||||
|
.curve(points.leftCp2, points.bottomCp1, points.bottom)
|
||||||
|
.curve(points.bottomCp2, points.rightCp1, points.right)
|
||||||
|
.curve(points.rightCp2, points.topCp1, points.top)
|
||||||
|
.close();
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
34
packages/tutorial/src/step5.js
Normal file
34
packages/tutorial/src/step5.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { Point, points, Path, paths, measurements, options } = part.shorthand();
|
||||||
|
|
||||||
|
let width = measurements.headCircumference * options.widthRatio;
|
||||||
|
let length = measurements.headCircumference * options.lengthRatio;
|
||||||
|
|
||||||
|
points.topLeft = new Point(
|
||||||
|
width / -2,
|
||||||
|
points.top.y - (width / 2 - points.right.x)
|
||||||
|
);
|
||||||
|
points.topRight = points.topLeft.shift(0, width);
|
||||||
|
points.bottomLeft = points.topLeft.shift(-90, length);
|
||||||
|
points.bottomRight = points.topRight.shift(-90, length);
|
||||||
|
|
||||||
|
paths.rect = new Path()
|
||||||
|
.move(points.topLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.topRight)
|
||||||
|
.line(points.topLeft)
|
||||||
|
.close();
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
39
packages/tutorial/src/step6.js
Normal file
39
packages/tutorial/src/step6.js
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
export default function(part) {
|
||||||
|
let { Point, points, Path, paths, measurements, options } = part.shorthand();
|
||||||
|
|
||||||
|
let width = measurements.headCircumference * options.widthRatio;
|
||||||
|
let length = measurements.headCircumference * options.lengthRatio;
|
||||||
|
|
||||||
|
points.edgeLeft = new Point(points.topLeft.x, points.left.y);
|
||||||
|
points.edgeRight = new Point(points.topRight.x, points.right.y);
|
||||||
|
points.edgeTop = new Point(0, points.topLeft.y);
|
||||||
|
|
||||||
|
points.edgeLeftCp = points.edgeLeft.shiftFractionTowards(points.topLeft, 0.5);
|
||||||
|
points.edgeRightCp = points.edgeLeftCp.flipX();
|
||||||
|
points.edgeTopLeftCp = points.edgeTop.shiftFractionTowards(
|
||||||
|
points.topLeft,
|
||||||
|
0.5
|
||||||
|
);
|
||||||
|
points.edgeTopRightCp = points.edgeTopLeftCp.flipX();
|
||||||
|
|
||||||
|
paths.rect = new Path()
|
||||||
|
.move(points.edgeTop)
|
||||||
|
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.edgeRight)
|
||||||
|
.curve(points.edgeRightCp, points.edgeTopRightCp, points.edgeTop)
|
||||||
|
.close();
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
44
packages/tutorial/src/step7.js
Normal file
44
packages/tutorial/src/step7.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
let strap = points.edgeTop.dy(points.top);
|
||||||
|
|
||||||
|
points.tipRight = points.edgeTop.translate(strap / 2, strap / 2);
|
||||||
|
points.tipRightTop = new Point(points.tipRight.x, points.edgeTop.y);
|
||||||
|
points.tipRightBottom = new Point(points.tipRight.x, points.top.y);
|
||||||
|
|
||||||
|
macro("round", {
|
||||||
|
from: points.edgeTop,
|
||||||
|
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
|
||||||
|
});
|
||||||
|
|
||||||
|
// Complete?
|
||||||
|
if (complete) {
|
||||||
|
if (sa) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paperless?
|
||||||
|
if (paperless) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
61
packages/tutorial/src/step8.js
Normal file
61
packages/tutorial/src/step8.js
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
let rotateThese = [
|
||||||
|
"edgeTopLeftCp",
|
||||||
|
"edgeTop",
|
||||||
|
"tipRight",
|
||||||
|
"tipRightTop",
|
||||||
|
"tipRightTopStart",
|
||||||
|
"tipRightTopCp1",
|
||||||
|
"tipRightTopCp2",
|
||||||
|
"tipRightTopEnd",
|
||||||
|
"tipRightBottomStart",
|
||||||
|
"tipRightBottomCp1",
|
||||||
|
"tipRightBottomCp2",
|
||||||
|
"tipRightBottomEnd",
|
||||||
|
"tipRightBottom",
|
||||||
|
"top",
|
||||||
|
"topCp2"
|
||||||
|
];
|
||||||
|
|
||||||
|
while (points.tipRightBottomStart.x > -1) {
|
||||||
|
for (let p of rotateThese) points[p] = points[p].rotate(1, points.edgeLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
points.snapLeft = points.top.shiftFractionTowards(points.edgeTop, 0.5);
|
||||||
|
|
||||||
|
macro("round", {
|
||||||
|
from: points.edgeTop,
|
||||||
|
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()
|
||||||
|
.move(points.edgeTop)
|
||||||
|
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.edgeRight)
|
||||||
|
.curve(points.edgeRightCp, points.edgeTopRightCp, points.edgeTop)
|
||||||
|
.close();
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
58
packages/tutorial/src/step9.js
Normal file
58
packages/tutorial/src/step9.js
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
export default function(part) {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
measurements,
|
||||||
|
options,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
points.edgeTopRightCp = points.edgeTopLeftCp.flipX();
|
||||||
|
points.topCp1 = points.topCp2.flipX();
|
||||||
|
points.tipLeftTopStart = points.tipRightTopStart.flipX();
|
||||||
|
points.tipLeftTopCp1 = points.tipRightTopCp1.flipX();
|
||||||
|
points.tipLeftTopCp2 = points.tipRightTopCp2.flipX();
|
||||||
|
points.tipLeftTopEnd = points.tipRightTopEnd.flipX();
|
||||||
|
points.tipLeftBottomStart = points.tipRightBottomStart.flipX();
|
||||||
|
points.tipLeftBottomCp1 = points.tipRightBottomCp1.flipX();
|
||||||
|
points.tipLeftBottomCp2 = points.tipRightBottomCp2.flipX();
|
||||||
|
points.tipLeftBottomEnd = points.tipRightBottomEnd.flipX();
|
||||||
|
points.snapRight = points.snapLeft.flipX();
|
||||||
|
|
||||||
|
paths.seam = new Path()
|
||||||
|
.move(points.edgeLeft)
|
||||||
|
.line(points.bottomLeft)
|
||||||
|
.line(points.bottomRight)
|
||||||
|
.line(points.edgeRight)
|
||||||
|
.curve(points.edgeRightCp, points.edgeTopRightCp, points.tipLeftTopStart)
|
||||||
|
.curve(points.tipLeftTopCp1, points.tipLeftTopCp2, points.tipLeftTopEnd)
|
||||||
|
.curve(
|
||||||
|
points.tipLeftBottomCp1,
|
||||||
|
points.tipLeftBottomCp2,
|
||||||
|
points.tipLeftBottomEnd
|
||||||
|
)
|
||||||
|
.curve(points.topCp1, points.rightCp2, points.right)
|
||||||
|
.curve(points.rightCp1, points.bottomCp2, points.bottom)
|
||||||
|
.curve(points.bottomCp1, points.leftCp2, points.left)
|
||||||
|
.curve(points.leftCp1, points.topCp2, points.tipRightBottomEnd)
|
||||||
|
.curve(
|
||||||
|
points.tipRightBottomCp2,
|
||||||
|
points.tipRightBottomCp1,
|
||||||
|
points.tipRightBottomStart
|
||||||
|
)
|
||||||
|
.curve(
|
||||||
|
points.tipRightTopCp2,
|
||||||
|
points.tipRightTopCp1,
|
||||||
|
points.tipRightTopStart
|
||||||
|
)
|
||||||
|
.curve(points.edgeTopLeftCp, points.edgeLeftCp, points.edgeLeft)
|
||||||
|
.close()
|
||||||
|
.attr("class", "fabric");
|
||||||
|
|
||||||
|
delete paths.neck;
|
||||||
|
delete paths.rect;
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue