1
0
Fork 0

refactor: Split plugin-gore from holmes pattern

This commit is contained in:
Joost De Cock 2020-02-22 14:18:40 +01:00
parent 7d02c76bc8
commit 992b010354
13 changed files with 635 additions and 100 deletions

View file

@ -0,0 +1,86 @@
# Change log for: @freesewing/holmes
## Unreleased
**Note:** Version bump only for package holmes
## 2.1.9 (2020-01-18)
**Note:** Version bump only for package holmes
## 2.1.8 (2019-12-16)
**Note:** Version bump only for package holmes
## 2.1.7 (2019-12-15)
**Note:** Version bump only for package holmes
## 2.1.6 (2019-11-24)
**Note:** Version bump only for package holmes
## 2.1.5 (2019-11-19)
**Note:** Version bump only for package holmes
## 2.1.4 (2019-11-01)
**Note:** Version bump only for package holmes
## 2.1.3 (2019-10-18)
**Note:** Version bump only for package holmes
## 2.1.2 (2019-10-14)
**Note:** Version bump only for package holmes
## 2.1.1 (2019-10-13)
**Note:** Version bump only for package holmes
## 2.1.0 (2019-10-06)
**Note:** Version bump only for package holmes
## 2.0.4 (2019-09-27)
**Note:** Version bump only for package holmes
## 2.0.3 (2019-09-15)
**Note:** Version bump only for package holmes
## 2.0.2 (2019-09-06)
**Note:** Version bump only for package holmes
## 2.0.1 (2019-09-01)
**Note:** Version bump only for package holmes
## 2.0.0 (2019-08-25)
This is the **initial release**, and the start of this change log.
Prior to version 2, FreeSewing was not a JavaScript project.
As such, that history is out of scope for this change log.

View file

@ -1,31 +1,100 @@
# holmes
![FreeSewing](https://freesewing.org/banner.jpg)
<p align='center'><a
href="https://www.npmjs.com/package/@freesewing/holmes"
title="@freesewing/holmes on NPM"
><img src="https://img.shields.io/npm/v/@freesewing/holmes.svg"
alt="@freesewing/holmes on NPM"/>
</a><a
href="https://opensource.org/licenses/MIT"
title="License: MIT"
><img src="https://img.shields.io/npm/l/@freesewing/holmes.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%3Aholmes"
title="Open issues tagged pkg:holmes"
><img src="https://img.shields.io/github/issues/freesewing/freesewing/pkg:holmes.svg?label=Issues"
alt="Open issues tagged pkg:holmes"/>
</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/chat"
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>
> Sherlock Holmes hat
## What am I looking at? 🤔
[![NPM](https://img.shields.io/npm/v/holmes.svg)](https://www.npmjs.com/package/holmes) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing).
This folder holds **@freesewing/holmes**
## Install
A FreeSewing pattern for a Sherlock Holmes hat
## About FreeSewing 💀
Where the world of makers and developers collide, that's where you'll find FreeSewing.
Our [core library](https://freesewing.dev/) is a *batteries-included* toolbox
for parametric design of sewing patterns. It's a modular system (check our list
of [plugins](https://freesewing.dev/plugins) and getting started is as simple as:
```bash
npm install --save holmes
npm init freesewing-pattern
```
## Usage
The [getting started](https://freesewing.dev/start) 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 reference](https://freesewing.dev/api),
as well as [our turorial](https://freesewing.dev/tutorial),
and [best practices](https://freesewing.dev/do).
```jsx
import React, { Component } from 'react'
If you're a maker, checkout [freesewing.org](https://freesewing/) where you can generate
our sewing patterns adapted to your measurements.
import MyComponent from 'holmes'
## Support FreeSewing: Become a patron 🥰
class Example extends Component {
render () {
return (
<MyComponent />
)
}
}
```
FreeSewing is an open source project run by a community,
and financially supported by our patrons.
## License
If you feel what we do is worthwhile, you too
should [become a patron](https://freesewing.org/patrons/join).
© [AlfaLyr](https://github.com/AlfaLyr)
## Links 👩‍💻
- 💻 Makers website: [freesewing.org](https://freesewing.org)
- 💻 Developers website: [freesewing.dev](https://freesewing.dev)
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/chat)
- 🐦 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/freesewing/chat) 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).

View file

@ -0,0 +1,10 @@
{
"plugins": [
["prismjs", {
"languages": ["javascript", "css", "markup"],
"plugins": ["line-numbers"],
"theme": "twilight",
"css": true
}]
]
}

View file

@ -1,6 +1,6 @@
{
"name": "holmes-example",
"homepage": "https://AlfaLyr.github.io/holmes",
"homepage": "https://freesewing.github.io/holmes",
"version": "0.0.0",
"private": true,
"dependencies": {
@ -19,7 +19,7 @@
"@material-ui/core": "^4.4.0",
"@material-ui/icons": "^4.2.1",
"@material-ui/lab": "^v4.0.0-alpha.25",
"pattern": "file:..",
"pattern": "link:..",
"prismjs": "1.17.1",
"react": "^16.9",
"react-dom": "^16.9",

View file

@ -9,14 +9,8 @@ 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"
/>
)
return <Workbench freesewing={freesewing} Pattern={Pattern} config={config} userLanguage="en" />
}
export default App

View file

@ -1,26 +1,43 @@
{
"name": "holmes",
"version": "0.0.1",
"description": "Sherlock Holmes hat",
"author": "AlfaLyr",
"name": "@freesewing/holmes",
"version": "2.2.0",
"description": "A FreeSewing pattern for a Sherlock Holmes hat",
"author": "AlfaLyr (https://github.com/alfalyr)",
"homepage": "https://freesewing.org/",
"repository": "github:freesewing/freesewing",
"license": "MIT",
"repository": "AlfaLyr/holmes",
"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.es.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
},
"module": "dist/index.mjs",
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"build": "rollup -c",
"clean": "rimraf dist",
"build": "npm run clean && rollup -c",
"test": "echo \"holmes: 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",
"prepare": "npm run build",
"predeploy": "cd example && npm install && npm run build",
"deploy": "gh-pages -d example/build"
"netlify": "echo \"Not configured yet\""
},
"peerDependencies": {
"@freesewing/core": "^2.2.0",
"@freesewing/plugin-bundle": "^2.2.0",
"@freesewing/plugin-bust": "^2.2.0"
},
"dependencies": {},
"devDependencies": {
"react": "^16.8",
"react-dom": "^16.8",
@ -29,23 +46,18 @@
"eslint": "^5.16.0",
"babel-jest": "24.7.1",
"jest": "24.7.1",
"@freesewing/core": "latest",
"@freesewing/plugin-bundle": "latest",
"@freesewing/components": "latest",
"@freesewing/css-theme": "latest",
"@freesewing/i18n": "latest",
"@freesewing/mui-theme": "latest",
"@freesewing/patterns": "latest",
"@freesewing/plugin-bust": "latest",
"@freesewing/plugin-buttons": "latest",
"@freesewing/plugin-debug": "latest",
"@freesewing/plugin-designer": "latest",
"@freesewing/plugin-flip": "latest",
"@freesewing/utils": "latest",
"@freesewing/components": "^2.2.0",
"@freesewing/css-theme": "^2.2.0",
"@freesewing/i18n": "^2.2.0",
"@freesewing/mui-theme": "^2.2.0",
"@freesewing/plugin-bust": "^2.2.0",
"@freesewing/plugin-buttons": "^2.2.0",
"@freesewing/plugin-flip": "^2.2.0",
"@freesewing/utils": "^2.2.0",
"@svgr/rollup": "^2.4.1",
"cross-env": "^5.1.4",
"gh-pages": "^1.2.0",
"react-scripts": "^3.0.1",
"react-scripts": "^3.0.0",
"webpack": "4.29.6",
"rollup": "^0.64.1",
"rollup-plugin-babel": "^4.0.1",
@ -56,11 +68,23 @@
"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/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"
"prop-types": "15.7.2"
},
"files": [
"dist/*",
"README.md",
"package.json"
],
"publishConfig": {
"access": "public",
"tag": "next"
},
"engines": {
"node": ">=8.0.0",
"npm": ">=5"
}
}

View file

@ -1,47 +1,41 @@
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 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 peerDepsExternal from 'rollup-plugin-peer-deps-external'
import { name, version, description, author, license, main, module } from './package.json'
import pkg from "./package.json";
const output = [
{
file: main,
format: 'cjs',
sourcemap: true
}
]
if (typeof module !== 'undefined')
output.push({
file: module,
format: 'es',
sourcemap: true
})
export default {
input: "src/index.js",
output: [
{
file: pkg.main,
format: "cjs",
sourcemap: true
},
{
file: pkg.module,
format: "es",
sourcemap: true
}
],
input: 'src/index.js',
output,
plugins: [
external(),
postcss({
modules: true
}),
url({ exclude: ["**/*.svg"] }),
svgr(),
babel({
exclude: "node_modules/**"
}),
resolve({ browser: true }),
json(),
peerDepsExternal(),
resolve({ modulesOnly: true }),
commonjs(),
json(),
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 */`
})
]
};
}

View file

@ -0,0 +1,86 @@
# Change log for: @freesewing/plugin-gore
## Unreleased
**Note:** Version bump only for package plugin-gore
## 2.1.9 (2020-01-18)
**Note:** Version bump only for package plugin-gore
## 2.1.8 (2019-12-16)
**Note:** Version bump only for package plugin-gore
## 2.1.7 (2019-12-15)
**Note:** Version bump only for package plugin-gore
## 2.1.6 (2019-11-24)
**Note:** Version bump only for package plugin-gore
## 2.1.5 (2019-11-19)
**Note:** Version bump only for package plugin-gore
## 2.1.4 (2019-11-01)
**Note:** Version bump only for package plugin-gore
## 2.1.3 (2019-10-18)
**Note:** Version bump only for package plugin-gore
## 2.1.2 (2019-10-14)
**Note:** Version bump only for package plugin-gore
## 2.1.1 (2019-10-13)
**Note:** Version bump only for package plugin-gore
## 2.1.0 (2019-10-06)
**Note:** Version bump only for package plugin-gore
## 2.0.4 (2019-09-27)
**Note:** Version bump only for package plugin-gore
## 2.0.3 (2019-09-15)
**Note:** Version bump only for package plugin-gore
## 2.0.2 (2019-09-06)
**Note:** Version bump only for package plugin-gore
## 2.0.1 (2019-09-01)
**Note:** Version bump only for package plugin-gore
## 2.0.0 (2019-08-25)
This is the **initial release**, and the start of this change log.
Prior to version 2, FreeSewing was not a JavaScript project.
As such, that history is out of scope for this change log.

View file

@ -0,0 +1,100 @@
![FreeSewing](https://freesewing.org/banner.jpg)
<p align='center'><a
href="https://www.npmjs.com/package/@freesewing/plugin-gore"
title="@freesewing/plugin-gore on NPM"
><img src="https://img.shields.io/npm/v/@freesewing/plugin-gore.svg"
alt="@freesewing/plugin-gore on NPM"/>
</a><a
href="https://opensource.org/licenses/MIT"
title="License: MIT"
><img src="https://img.shields.io/npm/l/@freesewing/plugin-gore.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%3Aplugin-gore"
title="Open issues tagged pkg:plugin-gore"
><img src="https://img.shields.io/github/issues/freesewing/freesewing/pkg:plugin-gore.svg?label=Issues"
alt="Open issues tagged pkg:plugin-gore"/>
</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/chat"
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>
## What am I looking at? 🤔
This repository is our *monorepo* holding [all our NPM packages](https://www.npmjs.com/search?q=keywords:freesewing).
This folder holds **@freesewing/plugin-gore**
A FreeSewing plugin to generate gores for a semi-sphere or dome
## About FreeSewing 💀
Where the world of makers and developers collide, that's where you'll find FreeSewing.
Our [core library](https://freesewing.dev/) is a *batteries-included* toolbox
for parametric design of sewing patterns. It's a modular system (check our list
of [plugins](https://freesewing.dev/plugins) and getting started is as simple as:
```bash
npm init freesewing-pattern
```
The [getting started](https://freesewing.dev/start) 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 reference](https://freesewing.dev/api),
as well as [our turorial](https://freesewing.dev/tutorial),
and [best practices](https://freesewing.dev/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.dev)
- 💬 Chat: [gitter.im/freesewing](https://gitter.im/freesewing/chat)
- 🐦 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/freesewing/chat) 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).

View file

@ -0,0 +1,52 @@
{
"name": "@freesewing/plugin-gore",
"version": "2.2.0",
"description": "A FreeSewing plugin to generate gores for a semi-sphere or dome",
"author": "AlfaLyr (https://github.com/alfalyr)",
"homepage": "https://freesewing.org/",
"repository": "github:freesewing/freesewing",
"license": "MIT",
"bugs": {
"url": "https://github.com/freesewing/freesewing/issues"
},
"keywords": [
"freesewing",
"plugin",
"sewing pattern",
"sewing",
"design",
"parametric design",
"made to measure",
"diy",
"fashion"
],
"main": "dist/index.js",
"module": "dist/index.mjs",
"scripts": {
"clean": "rimraf dist",
"build": "npm run clean && rollup -c",
"test": "echo \"plugin-gore: 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.2.0"
},
"dependencies": {},
"devDependencies": {},
"files": [
"dist/*",
"README.md",
"package.json"
],
"publishConfig": {
"access": "public",
"tag": "next"
},
"engines": {
"node": ">=8.0.0",
"npm": ">=5"
}
}

View file

@ -0,0 +1,41 @@
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 peerDepsExternal from 'rollup-plugin-peer-deps-external'
import { name, version, description, author, license, main, module } from './package.json'
const output = [
{
file: main,
format: 'cjs',
sourcemap: true
}
]
if (typeof module !== 'undefined')
output.push({
file: module,
format: 'es',
sourcemap: true
})
export default {
input: 'src/index.js',
output,
plugins: [
peerDepsExternal(),
resolve({ modulesOnly: true }),
commonjs(),
json(),
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 */`
})
]
}

View file

@ -0,0 +1,64 @@
import { name, version } from '../package.json'
export default {
name: name,
version: version,
hooks: {
preRender: function(svg) {
if (svg.attributes.get('freesewing:plugin-gore') === false)
svg.attributes.set('freesewing:plugin-gore', version)
}
},
macros: {
gore: function(so) {
let from = so.from
let goreNumber = so.goreNumber //number of gores for the complete sphere
let radius = so.radius //radius of the sphere
let prefix = so.prefix
let extraLength = so.extraLength //the length of the straight section after a complete semisphere
this.points[prefix + 'p1'] = from.shift(0, (radius * Math.PI) / 2 + extraLength)
this.points[prefix + 'Cp1'] = this.points[prefix + 'p1'].shift(
180 - 180 / goreNumber,
radius / 2 / Math.cos(Math.PI / goreNumber)
)
this.points[prefix + 'p3'] = from.shift(90, (radius * Math.PI) / goreNumber)
this.points[prefix + 'p2'] = this.points[prefix + 'p3'].shift(0, extraLength)
this.points[prefix + 'Cp2'] = this.points[prefix + 'p2'].shift(
0,
(radius * (Math.PI - 2)) / 2
)
if (extraLength < 0) {
//top curve used to calculate the new points if extraLength < 0
this.paths.auxiliaryPath = new this.Path()
.move(this.points[prefix + 'p1'])
.curve(
this.points[prefix + 'Cp1'],
this.points[prefix + 'Cp2'],
this.points[prefix + 'p2']
)
.setRender(false)
this.points[prefix + 'p2'] = this.paths.auxiliaryPath.intersectsX(0)[0] //the new point p2 is the one in which the auxiliary curve intersects x=0
this.paths.auxiliaryPath = this.paths.auxiliaryPath.split(this.points[prefix + 'p2'])[0] //the auxiliary curve is split
this.points[prefix + 'Cp1'] = this.paths.auxiliaryPath.ops[1].cp1 //the new control points are those of the new curve
this.points[prefix + 'Cp2'] = this.paths.auxiliaryPath.ops[1].cp2
this.points[prefix + 'p3'] = this.points[prefix + 'p2'].clone()
}
//the seam path is generated
this.paths[prefix + 'seam'] = new this.Path()
.move(from)
.line(this.points[prefix + 'p1'])
.curve(this.points[prefix + 'Cp1'], this.points[prefix + 'Cp2'], this.points[prefix + 'p2'])
.line(this.points[prefix + 'p3'])
.line(from)
.close()
.attr('class', so.class ? so.class : '')
if (typeof so.render !== 'undefined' && so.render) this.paths[prefix + 'seam'].render = true
else this.paths[prefix + 'seam'].render = false
}
}
}

View file

@ -0,0 +1,15 @@
import freesewing from 'freesewing'
import { version } from '../package.json'
let chai = require('chai')
let expect = chai.expect
chai.use(require('chai-string'))
let plugin = require('../dist/index.js')
it('Should set the plugin name:version attribute', () => {
let pattern = new freesewing.Pattern()
pattern
.use(plugin)
.draft()
.render()
expect(pattern.svg.attributes.get('freesewing:plugin-buttons')).to.equal(version)
})