construction: Migrated path_clone
This commit is contained in:
parent
9d43333b2e
commit
2d11ca434f
7 changed files with 40 additions and 35 deletions
|
@ -3,5 +3,8 @@ import { version } from "../package.json";
|
||||||
export default {
|
export default {
|
||||||
name: "examples",
|
name: "examples",
|
||||||
version,
|
version,
|
||||||
parts: ["pathAttr"]
|
dependencies: {
|
||||||
|
path_attr: "path_clone"
|
||||||
|
},
|
||||||
|
parts: ["path_attr", "path_clone"]
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
.use(freesewing.plugins.validate)
|
.use(freesewing.plugins.validate)
|
||||||
;
|
;
|
||||||
|
|
||||||
pattern.settings.only = ['pathAttr'];
|
//pattern.settings.only = ['pathAttr'];
|
||||||
pattern.draft();
|
pattern.draft();
|
||||||
document.getElementById("svg").innerHTML = pattern.render();
|
document.getElementById("svg").innerHTML = pattern.render();
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@ export default {
|
||||||
commonjs(),
|
commonjs(),
|
||||||
babel({
|
babel({
|
||||||
exclude: "node_modules/**"
|
exclude: "node_modules/**"
|
||||||
}),
|
|
||||||
terser({
|
|
||||||
output: {
|
|
||||||
preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
//terser({
|
||||||
|
// output: {
|
||||||
|
// preamble: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||||
|
// }
|
||||||
|
//})
|
||||||
],
|
],
|
||||||
external: ["freesewing", "@freesewing/plugin-bundle"],
|
external: ["freesewing", "@freesewing/plugin-bundle"],
|
||||||
output: {
|
output: {
|
||||||
|
|
|
@ -21,14 +21,14 @@ import pointTranslate from "./point.translate";
|
||||||
import pointSitsOn from "./point.sitson";
|
import pointSitsOn from "./point.sitson";
|
||||||
import pointClone from "./point.clone";
|
import pointClone from "./point.clone";
|
||||||
|
|
||||||
import draftPathAttr from "./pathAttr";
|
import draftPath_attr from "./path_attr";
|
||||||
|
import draftPath_clone from "./path_clone";
|
||||||
|
|
||||||
import pathOps from "./path.ops";
|
import pathOps from "./path.ops";
|
||||||
import pathOffset from "./path.offset";
|
import pathOffset from "./path.offset";
|
||||||
import pathLength from "./path.length";
|
import pathLength from "./path.length";
|
||||||
import pathStart from "./path.start";
|
import pathStart from "./path.start";
|
||||||
import pathEnd from "./path.end";
|
import pathEnd from "./path.end";
|
||||||
import pathClone from "./path.clone";
|
|
||||||
import pathJoin from "./path.join";
|
import pathJoin from "./path.join";
|
||||||
import pathReverse from "./path.reverse";
|
import pathReverse from "./path.reverse";
|
||||||
import pathShiftAlong from "./path.shiftalong";
|
import pathShiftAlong from "./path.shiftalong";
|
||||||
|
@ -77,7 +77,8 @@ Examples.prototype = Object.create(freesewing.Pattern.prototype);
|
||||||
Examples.prototype.constructor = Examples;
|
Examples.prototype.constructor = Examples;
|
||||||
|
|
||||||
// Attach per-part draft methods to prototype
|
// Attach per-part draft methods to prototype
|
||||||
Examples.prototype.draftPathAttr = draftPathAttr;
|
Examples.prototype.draftPath_attr = draftPath_attr;
|
||||||
|
Examples.prototype.draftPath_clone = draftPath_clone;
|
||||||
|
|
||||||
// Add custom snippet
|
// Add custom snippet
|
||||||
//pattern.on("preRender", function(next) {
|
//pattern.on("preRender", function(next) {
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import freesewing from "freesewing";
|
|
||||||
|
|
||||||
var pathClone = {
|
|
||||||
draft: function(part) {
|
|
||||||
// prettier-ignore
|
|
||||||
let {Point, points, Path, paths, Snippet, snippets, macro} = part.shorthand();
|
|
||||||
|
|
||||||
points.A = new Point(45, 60);
|
|
||||||
points.B = new Point(10, 30);
|
|
||||||
points.BCp2 = new Point(40, 20);
|
|
||||||
points.C = new Point(90, 30);
|
|
||||||
points.CCp1 = new Point(50, -30);
|
|
||||||
|
|
||||||
paths.example = new Path()
|
|
||||||
.move(points.A)
|
|
||||||
.line(points.B)
|
|
||||||
.curve(points.BCp2, points.CCp1, points.C);
|
|
||||||
|
|
||||||
paths.clone = paths.example.clone().attr("class", "note lashed stroke-xl");
|
|
||||||
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default pathClone;
|
|
26
packages/examples/src/path_clone.js
Normal file
26
packages/examples/src/path_clone.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
export default part => {
|
||||||
|
let {
|
||||||
|
Point,
|
||||||
|
points,
|
||||||
|
Path,
|
||||||
|
paths,
|
||||||
|
Snippet,
|
||||||
|
snippets,
|
||||||
|
macro
|
||||||
|
} = part.shorthand();
|
||||||
|
|
||||||
|
points.A = new Point(45, 60);
|
||||||
|
points.B = new Point(10, 30);
|
||||||
|
points.BCp2 = new Point(40, 20);
|
||||||
|
points.C = new Point(90, 30);
|
||||||
|
points.CCp1 = new Point(50, -30);
|
||||||
|
|
||||||
|
paths.example = new Path()
|
||||||
|
.move(points.A)
|
||||||
|
.line(points.B)
|
||||||
|
.curve(points.BCp2, points.CCp1, points.C);
|
||||||
|
|
||||||
|
paths.clone = paths.example.clone().attr("class", "note lashed stroke-xl");
|
||||||
|
|
||||||
|
return part;
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue