diff --git a/packages/plugin-dimension/README.md b/packages/plugin-dimension/README.md index aefbb5d0261..bb6555d5dfa 100644 --- a/packages/plugin-dimension/README.md +++ b/packages/plugin-dimension/README.md @@ -5,47 +5,113 @@
a library for made-to-measure sewing patterns -# freesewing / plugins / macro-cutonfold +# plugin-dimension -This is a macro for [freesewing](https://github.com/freesewing/freesewing) -to add cut-on-fold indicators on your patterns. +A [freesewing](https://github.com/freesewing/freesewing) +plugin to add dimensions to your (paperless) patterns. ## Install +Install this plugin from NPM: + ```sh -npm install @freesewing-plugins/macro-cutonfold --save +npm install @freesewing/plugins-dimension --save ``` ## Loading the plugin -Plugins are loaded by the `withPlugin` method of an instantiated freesewing pattern: +To load this plugin, add it to your instantiated pattern: ```js -import F from 'freesewing'; -import cutonfold from '@freesewing-plugins/macro-cutonfold'; +import pattern from '@freesewing/pattern-brian' +import theme from '@freesewing/plugin-theme' +import dimension from '@freesewing/plugin-dimension' -var pattern = new F.pattern() - .withPlugin(cutonfold); +pattern.with(theme).with(dimension); ``` -## Using the plugin +You now have the following macros available: -This plugin provides the `cutonfold` macro which you can call with the `macro` method on an instantiated pattern part: +Name | Description +----------|----------------------------------------------------- +`hd` | Adds a horizontal dimension +`vd` | Adds a vertical dimension +`ld` | Adds a linear dimension +`pd` | Adds a dimension that follows a path + +You can use them as such: + +```sh +macro('', {}); +``` + +## Parameters + +As all freesewing plugins, all options needs to be passed as a single object. + +### hd ```js -part.macro('cutonfold', { +part.macro('hd', { from: points.cbNeck -, to: points.cbHips +, to: points.cbHips, + y: points.cbHips + 15 }); ``` + - `from` : A point object + - `to` : A point object + - `y` : The y-value at which to place the dimension -### Parameters +### vd + +```js +part.macro('vd', { + from: points.cbNeck +, to: points.cbHips, + x: points.cbHips + 15 +}); +``` + - `from` : A point object + - `to` : A point object + - `x` : The x-value at which to place the dimension + +As all freesewing macros, bundle these parameters into a single object. + +### ld + +```js +part.macro('ld', { + from: points.cbNeck +, to: points.cbHips, + d: 15 +}); +``` + - `from` : A point object + - `to` : A point object + - `d` : The distance by which to offset the dimension from the line between from and to + +As all freesewing macros, bundle these parameters into a single object. + +### pd + +```js +part.macro('pd', { + path: new path().move(points.cbNeck).curve(points.cbNeckCp1, points.cbNeckCp2, points.cbHips), + d: 15 +}); +``` + - `path` : A path object + - `d` : The distance by which to offset the dimension from the path - - `to`: A point object at the start of the cut-on-fold indicator - - `from`: A point object at the end of the cut-on-fold indicator - As all freesewing macros, bundle these parameters into a single object. ## Example -FIXME: include example +Below is an example of different dimensions. + +![Example of the dimension plugin](https://github.com/freesewing/plugin-dimension/raw/master/img/example.png) + +## Where to get help + +Questions? Stuck? The [freesewing chat room on Gitter](https://gitter.im/freesewing/freesewing) +is the best place to ask for help. diff --git a/packages/plugin-dimension/img/example.png b/packages/plugin-dimension/img/example.png new file mode 100644 index 00000000000..ef8b3f06825 Binary files /dev/null and b/packages/plugin-dimension/img/example.png differ diff --git a/packages/plugin-dimension/rollup/commonjs.js b/packages/plugin-dimension/rollup/commonjs.js deleted file mode 100644 index 758823d701e..00000000000 --- a/packages/plugin-dimension/rollup/commonjs.js +++ /dev/null @@ -1,33 +0,0 @@ -import { terser } from "rollup-plugin-terser"; -import filesize from "rollup-plugin-filesize"; -import babel from "rollup-plugin-babel"; -import json from "rollup-plugin-json"; -import resolve from "rollup-plugin-node-resolve"; -import meta from "../package.json"; - -export default { - input: "src/index.js", - output: { - file: "dist/node.js", - format: "cjs" - }, - plugins: [ - resolve({ - browser: false - }), - json(), - babel({ - exclude: "node_modules/**" - }), - filesize() - //terser({ - // output: { - // preamble: `/**\n * ${meta.name} | v${meta.version}\n * ${ - // meta.description - // }\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${ - // meta.license - // }\n */` - // } - //}) - ] -}; diff --git a/packages/plugin-dimension/rollup/es.js b/packages/plugin-dimension/rollup/es.js deleted file mode 100644 index 746888e7ad4..00000000000 --- a/packages/plugin-dimension/rollup/es.js +++ /dev/null @@ -1,33 +0,0 @@ -import { terser } from "rollup-plugin-terser"; -import filesize from "rollup-plugin-filesize"; -import babel from "rollup-plugin-babel"; -import json from "rollup-plugin-json"; -import resolve from "rollup-plugin-node-resolve"; -import meta from "../package.json"; - -export default { - input: "src/index.js", - output: { - file: "dist/es.mjs", - format: "es" - }, - plugins: [ - resolve({ - browser: false - }), - json(), - babel({ - exclude: "node_modules/**" - }), - filesize() - //terser({ - // output: { - // preamble: `/**\n * ${meta.name} | v${meta.version}\n * ${ - // meta.description - // }\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${ - // meta.license - // }\n */` - // } - //}) - ] -}; diff --git a/packages/plugin-dimension/rollup/iife.js b/packages/plugin-dimension/rollup/iife.js deleted file mode 100644 index 717a6fd318c..00000000000 --- a/packages/plugin-dimension/rollup/iife.js +++ /dev/null @@ -1,32 +0,0 @@ -import { terser } from "rollup-plugin-terser"; -import babel from "rollup-plugin-babel"; -import resolve from "rollup-plugin-node-resolve"; -import json from "rollup-plugin-json"; -import meta from "../package.json"; - -export default { - input: "src/index.js", - output: { - file: "dist/browser.js", - format: "iife", - name: "freesewing.plugins.cutonfold" - }, - plugins: [ - resolve({ - browser: true - }), - json(), - babel({ - exclude: "node_modules/**" - }) - //terser({ - // output: { - // preamble: `/**\n * ${meta.name} | v${meta.version}\n * ${ - // meta.description - // }\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${ - // meta.license - // }\n */` - // } - //}) - ] -};