Merge pull request #107 from freesewing/waralee
Waralee ready to be merged
This commit is contained in:
commit
c4d48fc295
31 changed files with 1567 additions and 0 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -69,3 +69,9 @@ yarn-debug.log*
|
|||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
packages/core/.nyc_output
|
||||
packages/i18n/sort.sh
|
||||
packages/create-freesewing-pattern/index.js
|
||||
packages/create-freesewing-pattern/lib/cli.js
|
||||
.gitignore
|
||||
scripts/taskrunner.sh
|
||||
scripts/verdaccio.sh
|
||||
|
|
0
packages/create-freesewing-pattern/index.js
Executable file → Normal file
0
packages/create-freesewing-pattern/index.js
Executable file → Normal file
0
packages/create-freesewing-pattern/lib/cli.js
Executable file → Normal file
0
packages/create-freesewing-pattern/lib/cli.js
Executable file → Normal file
0
packages/i18n/sort.sh
Executable file → Normal file
0
packages/i18n/sort.sh
Executable file → Normal file
48
packages/i18n/src/locales/en/options/waralee.yml
Normal file
48
packages/i18n/src/locales/en/options/waralee.yml
Normal file
|
@ -0,0 +1,48 @@
|
|||
hem:
|
||||
title: Hem size
|
||||
description: Size of the hem at the bottom of the pants
|
||||
|
||||
waistBand:
|
||||
title: Waist Band
|
||||
description: Size of the waist band
|
||||
|
||||
waistRaise:
|
||||
title: Waist Raise
|
||||
description: How much to raise the waist from the seat depth measurement. This influences the depth of the crotch cut-out.
|
||||
|
||||
crotchBack:
|
||||
title: Crotch Back
|
||||
description: The percentage of the seat circumference that the back crotch needs to occupy. This creates more or less space between the side seam and the back.
|
||||
|
||||
crotchFront:
|
||||
title: Crotch Front
|
||||
description: The percentage of the seat circumference that the front crotch needs to occupy. This creates more or less space between the side seam and the front.
|
||||
|
||||
crotchFactorBackHor:
|
||||
title: Back Crotch Factor Horizontal
|
||||
description: Used to move the curve of the crotch in the back horizontally
|
||||
|
||||
crotchFactorBackVer:
|
||||
title: Back Crotch Factor Vertical
|
||||
description: Used to move the curve of the crotch in the back vertically
|
||||
|
||||
crotchFactorFrontHor:
|
||||
title: Front Crotch Factor Horizontal
|
||||
description: Used to move the curve of the crotch in the front horizontally
|
||||
|
||||
crotchFactorFrontVer:
|
||||
title: Front Crotch Factor Vertical
|
||||
description: Used to move the curve of the crotch in the front vertically
|
||||
|
||||
waistOverlap:
|
||||
title: Waist Overlap
|
||||
description: This dicates how much you want the leg flaps to overlap at the waist. A setting of 0 would have them meet at the side seam, and a setting of 100 makes them meet at the front/back.
|
||||
|
||||
legShortening:
|
||||
title: Leg Shortening
|
||||
description: This dictates how long the pants will be. It is a factor of the inseam measurement. The larger the value, the more that will be taken off the length.
|
||||
|
||||
backRaise:
|
||||
title: Back Raise
|
||||
description: This setting raises the waist in the back. Our waist does not sit horizontally, but is angled up at the back. This seting allows you to raise this in the back if you need it for a good fit.
|
||||
|
31
packages/waralee/README.md
Normal file
31
packages/waralee/README.md
Normal file
|
@ -0,0 +1,31 @@
|
|||
# waralee
|
||||
|
||||
> wrap pants
|
||||
|
||||
[](https://www.npmjs.com/package/waralee) [](https://standardjs.com)
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install --save waralee
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```jsx
|
||||
import React, { Component } from 'react'
|
||||
|
||||
import MyComponent from 'waralee'
|
||||
|
||||
class Example extends Component {
|
||||
render () {
|
||||
return (
|
||||
<MyComponent />
|
||||
)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
© [woutervdub](https://github.com/woutervdub)
|
71
packages/waralee/config/index.js
Normal file
71
packages/waralee/config/index.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
import { version } from "../package.json";
|
||||
|
||||
// ?? 🤔 ?? --> https://en.freesewing.dev/packages/core/config
|
||||
|
||||
export default {
|
||||
name: "waralee",
|
||||
version: "0.0.1",
|
||||
design: "woutervdub",
|
||||
code: "woutervdub",
|
||||
department: "menswear",
|
||||
type: "pattern",
|
||||
difficulty: 3,
|
||||
tags: [
|
||||
"freesewing",
|
||||
"design",
|
||||
"diy",
|
||||
"fashion",
|
||||
"made to measure",
|
||||
"parametric design",
|
||||
"pattern",
|
||||
"sewing",
|
||||
"sewing pattern"
|
||||
],
|
||||
optionGroups: {
|
||||
fit: ["legShortening", "waistOverlap", "backRaise"],
|
||||
advanced: [
|
||||
"crotchFront",
|
||||
"crotchBack",
|
||||
"crotchFactorBackHor",
|
||||
"crotchFactorBackVer",
|
||||
"crotchFactorFrontHor",
|
||||
"crotchFactorFrontVer",
|
||||
"waistRaise"
|
||||
]
|
||||
},
|
||||
measurements: [
|
||||
"hipsCircumference",
|
||||
"seatCircumference",
|
||||
"inseam",
|
||||
"seatDepth"
|
||||
],
|
||||
dependencies: {},
|
||||
inject: { pants: "pantsproto", mini: "pantsproto" },
|
||||
hide: [],
|
||||
parts: ["cutout", "pocket", "backPocket", "facings"],
|
||||
options: {
|
||||
minimizer: 5,
|
||||
frontPocketVerticalOffset: 0.07,
|
||||
frontPocketHorizontalOffset: 0.18,
|
||||
frontPocketSize: 0.65,
|
||||
frontPocket: { bool: true },
|
||||
frontPocketDepthFactor: 1.6,
|
||||
backPocketDepth: 140,
|
||||
backPocketVerticalOffset: 0.15,
|
||||
backPocketHorizontalOffset: 0.045,
|
||||
backPocketSize: 0.65,
|
||||
backPocket: { bool: true },
|
||||
hem: { mm: 15, min: 0, max: 100 },
|
||||
waistBand: { mm: 25, min: 0, max: 100 },
|
||||
waistRaise: { pct: 20, min: 0, max: 40 },
|
||||
crotchBack: { pct: 45, min: 10, max: 70 },
|
||||
crotchFront: { pct: 30, min: 10, max: 70 },
|
||||
crotchFactorFrontHor: { pct: 85, min: 10, max: 100 },
|
||||
crotchFactorFrontVer: { pct: 25, min: 10, max: 70 },
|
||||
crotchFactorBackHor: { pct: 90, min: 10, max: 100 },
|
||||
crotchFactorBackVer: { pct: 60, min: 20, max: 90 },
|
||||
waistOverlap: { pct: 50, min: 10, max: 100 },
|
||||
legShortening: { pct: 25, min: -10, max: 50 },
|
||||
backRaise: { pct: 10, min: 0, max: 25 }
|
||||
}
|
||||
};
|
10
packages/waralee/example/.babelrc
Normal file
10
packages/waralee/example/.babelrc
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"plugins": [
|
||||
["prismjs", {
|
||||
"languages": ["javascript", "css", "markup"],
|
||||
"plugins": ["line-numbers"],
|
||||
"theme": "twilight",
|
||||
"css": true
|
||||
}]
|
||||
]
|
||||
}
|
96
packages/waralee/example/README.md
Normal file
96
packages/waralee/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>
|
||||
|
||||
# waralee 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://test34.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).
|
||||
|
47
packages/waralee/example/package.json
Normal file
47
packages/waralee/example/package.json
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "waralee-example",
|
||||
"homepage": "https://woutervdub.github.io/waralee",
|
||||
"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-theme": "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": "file:..",
|
||||
"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/waralee/example/public/favicon.ico
Normal file
BIN
packages/waralee/example/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
40
packages/waralee/example/public/index.html
Normal file
40
packages/waralee/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>waralee</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/waralee/example/public/manifest.json
Normal file
15
packages/waralee/example/public/manifest.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"short_name": "waralee",
|
||||
"name": "waralee",
|
||||
"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/waralee/example/src/App.js
Normal file
22
packages/waralee/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;
|
9
packages/waralee/example/src/App.test.js
Normal file
9
packages/waralee/example/src/App.test.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import App from "./App";
|
||||
|
||||
it("renders without crashing", () => {
|
||||
const div = document.createElement("div");
|
||||
ReactDOM.render(<App />, div);
|
||||
ReactDOM.unmountComponentAtNode(div);
|
||||
});
|
11
packages/waralee/example/src/index.js
Normal file
11
packages/waralee/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/waralee/example/src/serviceWorker.js
Normal file
127
packages/waralee/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();
|
||||
});
|
||||
}
|
||||
}
|
66
packages/waralee/package.json
Normal file
66
packages/waralee/package.json
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"name": "waralee",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"author": "woutervdub",
|
||||
"license": "MIT",
|
||||
"repository": "woutervdub/waralee",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
"jsnext:main": "dist/index.es.js",
|
||||
"engines": {
|
||||
"node": ">=8",
|
||||
"npm": ">=5"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "cross-env CI=1 react-scripts test --env=jsdom",
|
||||
"test:watch": "react-scripts test --env=jsdom",
|
||||
"build": "rollup -c",
|
||||
"start": "rollup -c -w",
|
||||
"prepare": "npm run build",
|
||||
"predeploy": "cd example && npm install && npm run build",
|
||||
"deploy": "gh-pages -d example/build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react": "^16.8",
|
||||
"react-dom": "^16.8",
|
||||
"@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/core": "beta",
|
||||
"@freesewing/plugin-bundle": "beta",
|
||||
"@freesewing/components": "beta",
|
||||
"@freesewing/css-theme": "beta",
|
||||
"@freesewing/i18n": "beta",
|
||||
"@freesewing/mui-theme": "beta",
|
||||
"@freesewing/patterns": "beta",
|
||||
"@freesewing/plugin-bust": "beta",
|
||||
"@freesewing/plugin-buttons": "beta",
|
||||
"@freesewing/plugin-debug": "beta",
|
||||
"@freesewing/plugin-designer": "beta",
|
||||
"@freesewing/plugin-flip": "beta",
|
||||
"@freesewing/utils": "beta",
|
||||
"@svgr/rollup": "^2.4.1",
|
||||
"cross-env": "^5.1.4",
|
||||
"gh-pages": "^1.2.0",
|
||||
"react-scripts": "^3.0.1",
|
||||
"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": "^4.0.1",
|
||||
"@material-ui/icons": "^4.0.1",
|
||||
"@material-ui/lab": "^v4.0.0-alpha.14",
|
||||
"react-intl": "2.8.0",
|
||||
"prop-types": "15.7.2",
|
||||
"file-saver": "^2.0.2"
|
||||
}
|
||||
}
|
47
packages/waralee/rollup.config.js
Normal file
47
packages/waralee/rollup.config.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
import babel from "rollup-plugin-babel";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import external from "rollup-plugin-peer-deps-external";
|
||||
import postcss from "rollup-plugin-postcss";
|
||||
import json from "rollup-plugin-json";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import url from "rollup-plugin-url";
|
||||
import svgr from "@svgr/rollup";
|
||||
import minify from "rollup-plugin-babel-minify";
|
||||
import { name, version, description, author, license } from "./package.json";
|
||||
|
||||
import pkg from "./package.json";
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output: [
|
||||
{
|
||||
file: pkg.main,
|
||||
format: "cjs",
|
||||
sourcemap: true
|
||||
},
|
||||
{
|
||||
file: pkg.module,
|
||||
format: "es",
|
||||
sourcemap: true
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
external(),
|
||||
postcss({
|
||||
modules: true
|
||||
}),
|
||||
url({ exclude: ["**/*.svg"] }),
|
||||
svgr(),
|
||||
babel({
|
||||
exclude: "node_modules/**"
|
||||
}),
|
||||
resolve({ browser: true }),
|
||||
json(),
|
||||
commonjs(),
|
||||
minify({
|
||||
comments: false,
|
||||
sourceMap: true,
|
||||
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||
})
|
||||
]
|
||||
};
|
5
packages/waralee/src/.eslintrc
Normal file
5
packages/waralee/src/.eslintrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"env": {
|
||||
"jest": true
|
||||
}
|
||||
}
|
76
packages/waralee/src/backpocket.js
Normal file
76
packages/waralee/src/backpocket.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
measurements,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let pocketDepth = options.backPocketDepth;
|
||||
|
||||
points.topLeft = new Point(0, 0);
|
||||
points.bottomLeft = points.topLeft.shift(
|
||||
270,
|
||||
(pocketDepth + 30) * 2 +
|
||||
options.backPocketVerticalOffset * measurements.seatDepth
|
||||
);
|
||||
|
||||
points.topRight = points.topLeft.shift(
|
||||
0,
|
||||
options.backPocketSize * measurements.seatDepth + 24
|
||||
);
|
||||
points.bottomRight = points.topRight.shift(
|
||||
270,
|
||||
(pocketDepth + 30) * 2 +
|
||||
options.backPocketVerticalOffset * measurements.seatDepth
|
||||
);
|
||||
|
||||
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.title = points.topLeft.shift(270, 75).shift(0, 50);
|
||||
macro("title", {
|
||||
at: points.title,
|
||||
title: "2x " + "fromFabric"
|
||||
});
|
||||
|
||||
points.logo = points.title.shift(270, 75);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
points.text = points.logo
|
||||
.shift(-90, 25)
|
||||
.attr("data-text", "Waralee")
|
||||
.attr("data-text-class", "center");
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro("hd", {
|
||||
from: points.topLeft,
|
||||
to: points.topRight,
|
||||
y: points.topLeft.y + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.topLeft,
|
||||
to: points.bottomLeft,
|
||||
x: points.topLeft.x + 15
|
||||
});
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
84
packages/waralee/src/cutout.js
Normal file
84
packages/waralee/src/cutout.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
import { CreateCrotchPoints } from "./util";
|
||||
|
||||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
measurements,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let seatDepth = measurements.seatDepth + (measurements.seatDepth *options.waistRaise );
|
||||
|
||||
points.mWaist = new Point(0, 0);
|
||||
points.mHip = points.mWaist.shift(270, seatDepth);
|
||||
|
||||
CreateCrotchPoints(part);
|
||||
|
||||
points.mWaist1 = new Point( points.mWaist.x, points.fWaistSide.y );
|
||||
points.mWaist2 = new Point( points.mWaist.x, points.bWaistSide.y );
|
||||
|
||||
paths.seam = new Path()
|
||||
.move(points.mWaist1)
|
||||
.line(points.fWaistSide)
|
||||
.curve(points.fWaistCrotchCP, points.fHipCrotchCP, points.mHip)
|
||||
.curve(points.bHipCrotchCP, points.bWaistCrotchCP, points.bWaistSide)
|
||||
.line(points.mWaist2)
|
||||
.line(points.mWaist1)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
points.logo = points.mWaist.shift(270, 75);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
points.text = points.logo
|
||||
.shift(-90, 25)
|
||||
.attr("data-text", "Waralee")
|
||||
.attr("data-text-class", "center");
|
||||
|
||||
if (sa) {
|
||||
paths.seamAlternate = new Path()
|
||||
.move(points.bWaistSide)
|
||||
.curve(points.bWaistCrotchCP, points.bHipCrotchCP, points.mHip)
|
||||
.curve(points.fHipCrotchCP, points.fWaistCrotchCP, points.fWaistSide);
|
||||
|
||||
paths.sa = paths.seamAlternate.offset(sa).attr("class", "fabric sa");
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro("hd", {
|
||||
from: points.fWaistSide,
|
||||
to: points.mWaist,
|
||||
y: points.mWaist.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistSide,
|
||||
y: points.mWaist.y
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.mWaist1,
|
||||
to: points.mHip,
|
||||
x: points.mWaist.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.mWaist2,
|
||||
to: points.mWaist1,
|
||||
x: points.mWaist.x +15
|
||||
});
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
99
packages/waralee/src/facings.js
Normal file
99
packages/waralee/src/facings.js
Normal file
|
@ -0,0 +1,99 @@
|
|||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
measurements,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let frontPocketSize = options.frontPocketSize * measurements.seatDepth;
|
||||
let backPocketSize = options.backPocketSize * measurements.seatDepth;
|
||||
|
||||
points.frontTL = new Point(0, 0);
|
||||
points.frontTR = points.frontTL.shift(0, frontPocketSize + 24);
|
||||
points.frontBL = points.frontTL.shift(270, frontPocketSize / 2);
|
||||
points.frontBR = points.frontTR.shift(270, frontPocketSize / 2);
|
||||
|
||||
points.backTL = points.frontBL.shift(270, 50);
|
||||
points.backTR = points.backTL.shift(0, backPocketSize + 24);
|
||||
points.backBL = points.backTL.shift(270, backPocketSize / 2);
|
||||
points.backBR = points.backTR.shift(270, backPocketSize / 2);
|
||||
|
||||
paths.frontSeam = new Path()
|
||||
.move(points.frontTL)
|
||||
.line(points.frontBL)
|
||||
.line(points.frontBR)
|
||||
.line(points.frontTR)
|
||||
.line(points.frontTL)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
paths.backSeam = new Path()
|
||||
.move(points.backTL)
|
||||
.line(points.backBL)
|
||||
.line(points.backBR)
|
||||
.line(points.backTR)
|
||||
.line(points.backTL)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
points.frontTitle = points.frontTL.shift(270, 15).shift(0, 50);
|
||||
macro("title", {
|
||||
at: points.frontTitle.shift(0,30),
|
||||
title: "4x fromFabric"
|
||||
});
|
||||
points.frontLogo = points.frontTitle.shift(270, 15);
|
||||
snippets.frontLogo = new Snippet("logo", points.frontLogo).attr("data-scale", 0.4);
|
||||
points.frontText = points.frontLogo
|
||||
.shift(-90, 25)
|
||||
.attr("data-text", "Waralee")
|
||||
.attr("data-text-class", "center");
|
||||
|
||||
points.backTitle = points.backTL.shift(270, 15).shift(0, 50);
|
||||
macro("title", {
|
||||
at: points.backTitle.shift(0,30),
|
||||
title: "4x fromFabric"
|
||||
});
|
||||
points.backLogo = points.backTitle.shift(270, 15);
|
||||
snippets.backLogo = new Snippet("logo", points.backLogo).attr("data-scale", 0.4);
|
||||
points.backText = points.backLogo
|
||||
.shift(-90, 25)
|
||||
.attr("data-text", "Waralee")
|
||||
.attr("data-text-class", "center");
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro("hd", {
|
||||
from: points.frontTL,
|
||||
to: points.frontTR,
|
||||
y: points.frontTL.y + 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.backTL,
|
||||
to: points.backTR,
|
||||
y: points.backTL.y + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.frontTL,
|
||||
to: points.frontBL,
|
||||
x: points.frontTL.x + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.backTL,
|
||||
to: points.backBL,
|
||||
x: points.backTL.x + 15
|
||||
});
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
24
packages/waralee/src/index.js
Normal file
24
packages/waralee/src/index.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import freesewing from "@freesewing/core";
|
||||
import plugins from "@freesewing/plugin-bundle";
|
||||
import config from "../config";
|
||||
import draftPantsproto from "./pantsproto";
|
||||
import draftPants from "./pants";
|
||||
import draftCutout from "./cutout";
|
||||
import draftPocket from "./pocket";
|
||||
import draftBackPocket from "./backpocket";
|
||||
import draftFacings from "./facings";
|
||||
import draftMini from "./mini";
|
||||
|
||||
// Create new design
|
||||
const Pattern = new freesewing.Design(config, plugins);
|
||||
|
||||
// Attach the draft methods to the prototype
|
||||
Pattern.prototype.draftPantsproto = draftPantsproto;
|
||||
Pattern.prototype.draftPants = draftPants;
|
||||
Pattern.prototype.draftCutout = draftCutout;
|
||||
Pattern.prototype.draftPocket = draftPocket;
|
||||
Pattern.prototype.draftBackPocket = draftBackPocket;
|
||||
Pattern.prototype.draftFacings = draftFacings;
|
||||
Pattern.prototype.draftMini = draftMini;
|
||||
|
||||
export default Pattern;
|
158
packages/waralee/src/mini.js
Normal file
158
packages/waralee/src/mini.js
Normal file
|
@ -0,0 +1,158 @@
|
|||
// This is an idea to keep the printing to a minimum. The whole patterns is rather large.
|
||||
// To keep you from printing it completely, you could print this part in paperless mode
|
||||
// and only have a single sheet with all the dimensions on it.
|
||||
|
||||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
/*measurements,
|
||||
Point,
|
||||
Path,*/
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let mini = options.minimizer;
|
||||
|
||||
for( var p in points ) {
|
||||
points[p].x = points[p].x /mini;
|
||||
points[p].y = points[p].y /mini;
|
||||
}
|
||||
|
||||
|
||||
paths.waistFoldBack = paths.waistBack
|
||||
.offset(-1 * options.waistBand/mini)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
paths.waistFoldFront = paths.waistFront
|
||||
.offset(-1 * options.waistBand/mini)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
|
||||
paths.frontFold = paths.front
|
||||
.offset(-1 * options.hem/mini)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
paths.legFold = paths.leg
|
||||
.offset(-1 * options.hem/mini)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
paths.backFold = paths.back
|
||||
.offset(-1 * options.hem/mini)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
|
||||
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
points.logo = points.fWaistFront.shift(270, 400);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
points.text = points.logo
|
||||
.shift(-90, 50)
|
||||
.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.fWaistSide,
|
||||
to: points.mWaist,
|
||||
y: points.fWaistSide.y,
|
||||
text: part.units(points.fWaistSide.dist(points.mWaist)*mini)
|
||||
});
|
||||
/*
|
||||
macro("hd", {
|
||||
from: points.fWaistFrontOverlap,
|
||||
to: points.mWaist,
|
||||
y: points.fWaistSide.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistSide,
|
||||
y: points.bWaistSide.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistBack,
|
||||
y: points.bWaistSide.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistBackOverlap,
|
||||
y: points.bWaistSide.y - sa - 30
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.mWaist,
|
||||
to: points.mHip,
|
||||
x: points.mWaist.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.bWaistBack,
|
||||
x: points.bWaistSide.x + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bWaistBackOverlap,
|
||||
to: points.bLegBackOverlap,
|
||||
x: points.bLegBackOverlap.x - 30
|
||||
});
|
||||
|
||||
if (options.frontPocket) {
|
||||
macro("vd", {
|
||||
from: points.fWaistSide,
|
||||
to: points.frontPocketTop,
|
||||
x: points.frontPocketTop.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.fWaistSide,
|
||||
to: points.frontPocketBottom,
|
||||
x: points.frontPocketBottom.x
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.frontPocketTop,
|
||||
to: points.fWaistSide,
|
||||
y: points.frontPocketTop.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.frontPocketBottom,
|
||||
to: points.fWaistSide,
|
||||
y: points.frontPocketBottom.y
|
||||
});
|
||||
}
|
||||
if (options.backPocket) {
|
||||
macro("vd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketLeft,
|
||||
x: points.backPocketLeft.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketRight,
|
||||
x: points.backPocketRight.x
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketLeft,
|
||||
y: points.backPocketLeft.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketRight,
|
||||
y: points.backPocketRight.y
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// keep this secret for now:
|
||||
part.render = false;
|
||||
|
||||
return part;
|
||||
}
|
148
packages/waralee/src/pants.js
Normal file
148
packages/waralee/src/pants.js
Normal file
|
@ -0,0 +1,148 @@
|
|||
import { CreateCrotchPoints } from "./util";
|
||||
|
||||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
measurements,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let seatDepth =
|
||||
measurements.seatDepth + measurements.seatDepth * options.waistRaise;
|
||||
let circumference = measurements.seatCircumference;
|
||||
let circumference4 = circumference / 4;
|
||||
|
||||
|
||||
paths.waistFoldBack = paths.waistBack
|
||||
.offset(-1 * options.waistBand)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
paths.waistFoldFront = paths.waistFront
|
||||
.offset(-1 * options.waistBand)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
|
||||
paths.frontFold = paths.front
|
||||
.offset(-1 * options.hem)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
paths.legFold = paths.leg
|
||||
.offset(-1 * options.hem)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
paths.backFold = paths.back
|
||||
.offset(-1 * options.hem)
|
||||
.attr("class", "fabric stroke-sm");
|
||||
|
||||
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
points.logo = points.fWaistFront.shift(270, 400);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
points.text = points.logo
|
||||
.shift(-90, 50)
|
||||
.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.fWaistSide,
|
||||
to: points.mWaist,
|
||||
y: points.fWaistSide.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.fWaistFrontOverlap,
|
||||
to: points.mWaist,
|
||||
y: points.fWaistSide.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistSide,
|
||||
y: points.bWaistSide.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistBack,
|
||||
y: points.bWaistSide.y - sa - 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.mWaist,
|
||||
to: points.bWaistBackOverlap,
|
||||
y: points.bWaistSide.y - sa - 30
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.mWaist,
|
||||
to: points.mHip,
|
||||
x: points.mWaist.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.bWaistBack,
|
||||
x: points.bWaistSide.x + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bWaistBackOverlap,
|
||||
to: points.bLegBackOverlap,
|
||||
x: points.bLegBackOverlap.x - 30
|
||||
});
|
||||
|
||||
if (options.frontPocket) {
|
||||
macro("vd", {
|
||||
from: points.fWaistSide,
|
||||
to: points.frontPocketTop,
|
||||
x: points.frontPocketTop.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.fWaistSide,
|
||||
to: points.frontPocketBottom,
|
||||
x: points.frontPocketBottom.x
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.frontPocketTop,
|
||||
to: points.fWaistSide,
|
||||
y: points.frontPocketTop.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.frontPocketBottom,
|
||||
to: points.fWaistSide,
|
||||
y: points.frontPocketBottom.y
|
||||
});
|
||||
}
|
||||
if (options.backPocket) {
|
||||
macro("vd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketLeft,
|
||||
x: points.backPocketLeft.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketRight,
|
||||
x: points.backPocketRight.x
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketLeft,
|
||||
y: points.backPocketLeft.y
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.bWaistSide,
|
||||
to: points.backPocketRight,
|
||||
y: points.backPocketRight.y
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
189
packages/waralee/src/pantsproto.js
Normal file
189
packages/waralee/src/pantsproto.js
Normal file
|
@ -0,0 +1,189 @@
|
|||
import { CreateCrotchPoints } from "./util";
|
||||
|
||||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
measurements,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let seatDepth =
|
||||
measurements.seatDepth + measurements.seatDepth * options.waistRaise;
|
||||
let circumference = measurements.seatCircumference;
|
||||
let circumference4 = circumference / 4;
|
||||
|
||||
points.mWaist = new Point(0, 0);
|
||||
|
||||
CreateCrotchPoints(part);
|
||||
|
||||
points.mLeg = points.mHip.shift(270, measurements.inseam * (1 -options.legShortening));
|
||||
points.fLegSide = points.mLeg.shift(
|
||||
180,
|
||||
options.crotchFront * circumference4
|
||||
);
|
||||
points.bLegSide = points.mLeg.shift(0, options.crotchBack * circumference4);
|
||||
|
||||
points.fWaistFront = points.fWaistSide.shift(180, circumference4);
|
||||
points.fWaistFrontOverlap = points.fWaistFront.shift(
|
||||
180,
|
||||
options.waistOverlap * circumference4
|
||||
);
|
||||
points.fHipFront = points.fHipSide.shift(180, circumference4);
|
||||
points.fHipFrontOverlap = points.fHipFront.shift(
|
||||
180,
|
||||
options.waistOverlap * circumference4
|
||||
);
|
||||
points.fLegFront = points.fLegSide.shift(180, circumference4);
|
||||
points.fLegFrontOverlap = points.fLegFront.shift(
|
||||
180,
|
||||
options.waistOverlap * circumference4
|
||||
);
|
||||
|
||||
// Calculate the distance we need to move horizontally to get to the point that will
|
||||
// diagonally be the distance we're looking for (circumference/4)
|
||||
let bHorDistance = Math.sqrt(
|
||||
circumference4 * circumference4 -
|
||||
options.backRaise * seatDepth * options.backRaise * seatDepth
|
||||
);
|
||||
// Create a point that is this distance from the side.
|
||||
points.bWaistBack = points.mWaist
|
||||
.shift(90, options.waistBand)
|
||||
.shift(0, options.crotchBack * circumference4 + bHorDistance);
|
||||
|
||||
points.bWaistBackOverlap = points.bWaistBack.shift(
|
||||
0,
|
||||
options.waistOverlap * circumference4
|
||||
);
|
||||
|
||||
points.bHipBack = points.bHipSide.shift(0, circumference4);
|
||||
points.bHipBackOverlap = points.bHipBack.shift(
|
||||
0,
|
||||
options.waistOverlap * circumference4
|
||||
);
|
||||
points.bLegBack = points.bLegSide.shift(0, circumference4);
|
||||
points.bLegBackOverlap = points.bLegBack.shift(
|
||||
0,
|
||||
options.waistOverlap * circumference4
|
||||
);
|
||||
|
||||
points.bWaistSideTemp = points.bWaistSide.shift(0, 2); // This is a trick to make the offset() call work. Without it, the offset is crossing the cutout line.
|
||||
paths.waistBack = new Path()
|
||||
.move(points.bWaistBackOverlap)
|
||||
.line(points.bWaistBack)
|
||||
.line(points.bWaistSideTemp) // This is a trick to make the offset() call work. Without it, the offset is crossing the cutout line.
|
||||
.line(points.bWaistSide)
|
||||
.setRender( false );
|
||||
paths.waistFront = new Path()
|
||||
.move(points.fWaistSide)
|
||||
.line(points.fWaistFront)
|
||||
.line(points.fWaistFrontOverlap)
|
||||
.setRender( false );
|
||||
paths.front = new Path()
|
||||
.move(points.fWaistFrontOverlap)
|
||||
.line(points.fHipFrontOverlap)
|
||||
.line(points.fLegFrontOverlap)
|
||||
.setRender( false );
|
||||
paths.back = new Path()
|
||||
.move(points.bLegBackOverlap)
|
||||
.line(points.bHipBackOverlap)
|
||||
.line(points.bWaistBackOverlap)
|
||||
.setRender( false );
|
||||
paths.leg = new Path()
|
||||
.move(points.fLegFrontOverlap)
|
||||
.line(points.bLegBackOverlap)
|
||||
.setRender( false );
|
||||
paths.cutout = new Path()
|
||||
.move(points.bWaistSide)
|
||||
.curve(points.bWaistCrotchCP, points.bHipCrotchCP, points.mHip)
|
||||
.curve(points.fHipCrotchCP, points.fWaistCrotchCP, points.fWaistSide)
|
||||
.setRender( false );
|
||||
|
||||
paths.seam = paths.waistFront
|
||||
.join(paths.front)
|
||||
.join(paths.leg)
|
||||
.join(paths.back)
|
||||
.join(paths.waistBack)
|
||||
.join(paths.cutout)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
if (options.frontPocket) {
|
||||
points.frontPocketTop = points.fWaistSide
|
||||
.shift(
|
||||
270,
|
||||
options.frontPocketVerticalOffset * measurements.seatDepth +
|
||||
options.waistBand * 2
|
||||
)
|
||||
.shift(
|
||||
180,
|
||||
options.frontPocketHorizontalOffset * measurements.seatCircumference
|
||||
);
|
||||
|
||||
points.frontPocketTop2 = points.frontPocketTop.shift(340, 12);
|
||||
points.frontPocketBottom = points.frontPocketTop.shift(
|
||||
250,
|
||||
options.frontPocketSize * measurements.seatDepth
|
||||
);
|
||||
points.frontPocketBottom2 = points.frontPocketBottom.shift(340, 12);
|
||||
|
||||
paths.frontPocket = new Path()
|
||||
.move(points.frontPocketTop)
|
||||
.line(points.frontPocketBottom)
|
||||
.line(points.frontPocketBottom2)
|
||||
.line(points.frontPocketTop2)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
}
|
||||
|
||||
if (options.backPocket) {
|
||||
points.backPocketRight = points.bWaistBack
|
||||
.shiftTowards(
|
||||
points.bWaistSide,
|
||||
options.backPocketHorizontalOffset * measurements.seatCircumference
|
||||
)
|
||||
.shift(
|
||||
270,
|
||||
options.backPocketVerticalOffset * measurements.seatDepth +
|
||||
options.waistBand * 2
|
||||
);
|
||||
points.backPocketLeft = points.bWaistBack
|
||||
.shiftTowards(
|
||||
points.bWaistSide,
|
||||
options.backPocketHorizontalOffset * measurements.seatCircumference +
|
||||
options.backPocketSize * measurements.seatDepth
|
||||
)
|
||||
.shift(
|
||||
270,
|
||||
options.backPocketVerticalOffset * measurements.seatDepth +
|
||||
options.waistBand * 2
|
||||
);
|
||||
points.backPocketRight2 = points.backPocketRight.shift(
|
||||
points.backPocketRight.angle(points.backPocketLeft) + 90,
|
||||
12
|
||||
);
|
||||
points.backPocketLeft2 = points.backPocketLeft.shift(
|
||||
points.backPocketLeft.angle(points.backPocketRight) - 90,
|
||||
12
|
||||
);
|
||||
|
||||
paths.backPocket = new Path()
|
||||
.move(points.backPocketLeft)
|
||||
.line(points.backPocketLeft2)
|
||||
.line(points.backPocketRight2)
|
||||
.line(points.backPocketRight)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
}
|
||||
|
||||
part.render = false;
|
||||
|
||||
return part;
|
||||
}
|
103
packages/waralee/src/pocket.js
Normal file
103
packages/waralee/src/pocket.js
Normal file
|
@ -0,0 +1,103 @@
|
|||
export default function(part) {
|
||||
let {
|
||||
options,
|
||||
measurements,
|
||||
Point,
|
||||
Path,
|
||||
points,
|
||||
paths,
|
||||
Snippet,
|
||||
snippets,
|
||||
complete,
|
||||
sa,
|
||||
paperless,
|
||||
macro
|
||||
} = part.shorthand();
|
||||
|
||||
let pocketDepth = measurements.seatDepth * options.frontPocketDepthFactor;
|
||||
|
||||
points.topLeft = new Point(0, 0);
|
||||
points.bottomLeft = points.topLeft.shift(270, pocketDepth);
|
||||
|
||||
points.topRight = points.topLeft.shift(0, pocketDepth * (1 / 3));
|
||||
points.bottomRight = points.topRight.shift(290, pocketDepth *(5/6));
|
||||
|
||||
points.bottomLeftCP = points.bottomLeft.shift(0, pocketDepth * (1 / 6));
|
||||
points.bottomRightCP = points.bottomRight.shift(225, pocketDepth * (1 / 4));
|
||||
|
||||
paths.seam = new Path()
|
||||
.move(points.topLeft)
|
||||
.line(points.bottomLeft)
|
||||
.curve(points.bottomLeftCP, points.bottomRightCP, points.bottomRight)
|
||||
.line(points.topRight)
|
||||
.line(points.topLeft)
|
||||
.close()
|
||||
.attr("class", "fabric");
|
||||
|
||||
// Complete?
|
||||
if (complete) {
|
||||
macro("cutonfold", {
|
||||
from: points.topLeft,
|
||||
to: points.bottomLeft,
|
||||
margin: 5,
|
||||
offset: 10
|
||||
});
|
||||
points.title = points.topLeft.shift(270, 75).shift(0, 50);
|
||||
macro("title", {
|
||||
at: points.title,
|
||||
title: "1x " + "cutOnFold" + " " + "fromFabric"
|
||||
});
|
||||
|
||||
points.logo = points.title.shift(270, 75);
|
||||
snippets.logo = new Snippet("logo", points.logo);
|
||||
points.text = points.logo
|
||||
.shift(-90, 25)
|
||||
.attr("data-text", "Waralee")
|
||||
.attr("data-text-class", "center");
|
||||
|
||||
if (sa) {
|
||||
paths.sa = new Path()
|
||||
.move(points.bottomLeft)
|
||||
.join( new Path()
|
||||
.move(points.bottomLeft)
|
||||
.curve(points.bottomLeftCP, points.bottomRightCP, points.bottomRight)
|
||||
.line(points.topRight)
|
||||
.line(points.topLeft)
|
||||
.offset(sa)
|
||||
)
|
||||
.line(points.topLeft)
|
||||
.attr("class", "fabric sa");
|
||||
}
|
||||
}
|
||||
|
||||
// Paperless?
|
||||
if (paperless) {
|
||||
macro("hd", {
|
||||
from: points.topLeft,
|
||||
to: points.topRight,
|
||||
y: points.topLeft.y + 15
|
||||
});
|
||||
macro("hd", {
|
||||
from: points.bottomLeft,
|
||||
to: points.bottomRight,
|
||||
y: points.bottomRight.y
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.topLeft,
|
||||
to: points.bottomLeft,
|
||||
x: points.topLeft.x + 15
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.topRight,
|
||||
to: points.bottomRight,
|
||||
x: points.bottomRight.x
|
||||
});
|
||||
macro("vd", {
|
||||
from: points.bottomRight,
|
||||
to: points.bottomLeft,
|
||||
x: points.bottomRight.x
|
||||
});
|
||||
}
|
||||
|
||||
return part;
|
||||
}
|
35
packages/waralee/src/util.js
Normal file
35
packages/waralee/src/util.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
function CreateCrotchPoints(part) {
|
||||
let { options, measurements, points } = part.shorthand();
|
||||
|
||||
let seatDepth = measurements.seatDepth + (measurements.seatDepth *options.waistRaise );
|
||||
let circumference = measurements.seatCircumference;
|
||||
let circumference4 = circumference / 4;
|
||||
|
||||
points.mHip = points.mWaist.shift(270, seatDepth);
|
||||
|
||||
points.fWaistSide = points.mWaist
|
||||
.shift(180, options.crotchFront * circumference4)
|
||||
.shift( 90, options.waistBand );
|
||||
points.fWaistCrotchCP = points.fWaistSide.shift(
|
||||
270,
|
||||
seatDepth * options.crotchFactorFrontVer +options.waistBand
|
||||
);
|
||||
points.fHipCrotchCP = points.mHip
|
||||
.shift(180,options.crotchFront * circumference4 * options.crotchFactorFrontHor);
|
||||
|
||||
points.fHipSide = points.mHip
|
||||
.shift(180, options.crotchFront * circumference4 );
|
||||
|
||||
points.bWaistSide = points.mWaist
|
||||
.shift( 0, options.crotchBack * circumference4)
|
||||
.shift(90, options.waistBand )
|
||||
.shift(90, options.backRaise * seatDepth);
|
||||
points.bWaistCrotchCP = points.bWaistSide
|
||||
.shift(270, seatDepth * options.crotchFactorBackVer );
|
||||
points.bHipCrotchCP = points.mHip
|
||||
.shift(0,options.crotchBack * circumference4 * options.crotchFactorBackHor);
|
||||
|
||||
points.bHipSide = points.mHip.shift(0, options.crotchBack * circumference4 );
|
||||
}
|
||||
|
||||
export { CreateCrotchPoints };
|
0
scripts/taskrunner.sh
Executable file → Normal file
0
scripts/taskrunner.sh
Executable file → Normal file
0
scripts/verdaccio.sh
Executable file → Normal file
0
scripts/verdaccio.sh
Executable file → Normal file
Loading…
Add table
Add a link
Reference in a new issue