sparkles: Added _curve and curve_ to path.ops example
This commit is contained in:
parent
9fbcafbe38
commit
5ad7a7ede9
6 changed files with 50 additions and 53 deletions
|
@ -6,10 +6,12 @@ export default {
|
||||||
// This is not needed, but is here to sidestep an issue in freesewing
|
// This is not needed, but is here to sidestep an issue in freesewing
|
||||||
// that needs to be fixed but hasn't yet
|
// that needs to be fixed but hasn't yet
|
||||||
dependencies: {
|
dependencies: {
|
||||||
path_attr: "path_clone"
|
path_attr: "path_ops"
|
||||||
},
|
},
|
||||||
parts: [
|
parts: [
|
||||||
"point_attr",
|
"point_attr",
|
||||||
|
"path__curve",
|
||||||
|
"path_curve_",
|
||||||
"path_attr",
|
"path_attr",
|
||||||
"path_clone",
|
"path_clone",
|
||||||
"path_divide",
|
"path_divide",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Examples</title>
|
<title>Examples</title>
|
||||||
<script type="text/javascript" src="node_modules/freesewing/dist/browser.js"></script>
|
<script type="text/javascript" src="../../freesewing//dist/browser.js"></script>
|
||||||
<script type="text/javascript" src="node_modules/@freesewing/plugin-bundle/dist/browser.js"></script>
|
<script type="text/javascript" src="node_modules/@freesewing/plugin-bundle/dist/browser.js"></script>
|
||||||
<script type="text/javascript" src="dist/browser.js"></script>
|
<script type="text/javascript" src="dist/browser.js"></script>
|
||||||
<script type="text/javascript" src="node_modules/@freesewing/plugin-theme/dist/browser.js"></script>
|
<script type="text/javascript" src="node_modules/@freesewing/plugin-theme/dist/browser.js"></script>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
.use(freesewing.plugins.validate)
|
.use(freesewing.plugins.validate)
|
||||||
;
|
;
|
||||||
|
|
||||||
//pattern.settings.only = ['pathAttr'];
|
pattern.settings.only = ['path_ops'];
|
||||||
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: {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import plugins from "@freesewing/plugin-bundle";
|
||||||
import config from "../config/";
|
import config from "../config/";
|
||||||
import { version } from "../package.json";
|
import { version } from "../package.json";
|
||||||
|
|
||||||
|
import draftPath_ops from "./path_ops";
|
||||||
import draftPath_attr from "./path_attr";
|
import draftPath_attr from "./path_attr";
|
||||||
import draftPath_clone from "./path_clone";
|
import draftPath_clone from "./path_clone";
|
||||||
import draftPath_divide from "./path_divide";
|
import draftPath_divide from "./path_divide";
|
||||||
|
@ -15,7 +16,6 @@ import draftPath_intersectsy from "./path_intersectsy";
|
||||||
import draftPath_join from "./path_join";
|
import draftPath_join from "./path_join";
|
||||||
import draftPath_length from "./path_length";
|
import draftPath_length from "./path_length";
|
||||||
import draftPath_offset from "./path_offset";
|
import draftPath_offset from "./path_offset";
|
||||||
import draftPath_ops from "./path_ops";
|
|
||||||
import draftPath_reverse from "./path_reverse";
|
import draftPath_reverse from "./path_reverse";
|
||||||
import draftPath_shiftalong from "./path_shiftalong";
|
import draftPath_shiftalong from "./path_shiftalong";
|
||||||
import draftPath_shiftfractionalong from "./path_shiftfractionalong";
|
import draftPath_shiftfractionalong from "./path_shiftfractionalong";
|
||||||
|
@ -76,7 +76,13 @@ 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.draftPoint_attr = draftPoint_attr;
|
|
||||||
|
Examples.prototype.draftPath_move = draftPath_ops;
|
||||||
|
Examples.prototype.draftPath_line = draftPath_ops;
|
||||||
|
Examples.prototype.draftPath_curve = draftPath_ops;
|
||||||
|
Examples.prototype.draftPath__curve = draftPath_ops;
|
||||||
|
Examples.prototype.draftPath_curve_ = draftPath_ops;
|
||||||
|
Examples.prototype.draftPath_close = draftPath_ops;
|
||||||
|
|
||||||
Examples.prototype.draftPath_attr = draftPath_attr;
|
Examples.prototype.draftPath_attr = draftPath_attr;
|
||||||
Examples.prototype.draftPath_clone = draftPath_clone;
|
Examples.prototype.draftPath_clone = draftPath_clone;
|
||||||
|
@ -105,6 +111,7 @@ Examples.prototype.draftPlugin_logo = draftPlugin_logo;
|
||||||
Examples.prototype.draftPlugin_scalebox = draftPlugin_scalebox;
|
Examples.prototype.draftPlugin_scalebox = draftPlugin_scalebox;
|
||||||
Examples.prototype.draftPlugin_title = draftPlugin_title;
|
Examples.prototype.draftPlugin_title = draftPlugin_title;
|
||||||
|
|
||||||
|
Examples.prototype.draftPoint_attr = draftPoint_attr;
|
||||||
Examples.prototype.draftPoint_angle = draftPoint_angle;
|
Examples.prototype.draftPoint_angle = draftPoint_angle;
|
||||||
Examples.prototype.draftPoint_attr = draftPoint_attr;
|
Examples.prototype.draftPoint_attr = draftPoint_attr;
|
||||||
Examples.prototype.draftPoint_clone = draftPoint_clone;
|
Examples.prototype.draftPoint_clone = draftPoint_clone;
|
||||||
|
|
|
@ -1,63 +1,53 @@
|
||||||
export default part => {
|
export default part => {
|
||||||
let {
|
let { Point, points, Path, paths } = part.shorthand();
|
||||||
Point,
|
|
||||||
points,
|
|
||||||
Path,
|
|
||||||
paths,
|
|
||||||
Snippet,
|
|
||||||
snippets,
|
|
||||||
macro
|
|
||||||
} = part.shorthand();
|
|
||||||
|
|
||||||
points.A = new Point(10, 10)
|
points.A = new Point(10, 10)
|
||||||
.attr("data-text", "Move to point A")
|
.attr("data-text", "msg_move")
|
||||||
.attr("data-text-class", "center text-xs");
|
.attr("data-text-class", "center text-xs");
|
||||||
points.B = new Point(70, 30);
|
points.B = new Point(70, 30);
|
||||||
points.BCp2 = new Point(40, 10);
|
points.BCp2 = new Point(40, 10);
|
||||||
points.C = new Point(90, -50);
|
points.C = new Point(90, -50);
|
||||||
points.CCp1 = new Point(125, -30);
|
points.CCp1 = new Point(125, -30);
|
||||||
|
points.D = new Point(20, -50);
|
||||||
|
points.DCp = new Point(40, 0);
|
||||||
|
points.E = new Point(-20, -20);
|
||||||
|
points.ECp = new Point(-20, -50);
|
||||||
|
|
||||||
paths.example = new Path()
|
paths.line = new Path()
|
||||||
.move(points.A)
|
.move(points.A)
|
||||||
.line(points.B)
|
.line(points.B)
|
||||||
.curve(points.BCp2, points.CCp1, points.C)
|
.attr("data-text", "msg_line")
|
||||||
.close();
|
.attr("data-text-class", "center text-xs");
|
||||||
|
|
||||||
paths.handle1 = new Path()
|
paths.curve = new Path()
|
||||||
.move(points.B)
|
.move(points.B)
|
||||||
.line(points.BCp2)
|
.curve(points.BCp2, points.CCp1, points.C)
|
||||||
.attr("class", "note dashed");
|
.attr("data-text", "msg_curve")
|
||||||
paths.handle2 = new Path()
|
.attr("data-text-class", "center text-xs");
|
||||||
|
|
||||||
|
paths._curve = new Path()
|
||||||
.move(points.C)
|
.move(points.C)
|
||||||
.line(points.CCp1)
|
._curve(points.DCp, points.D)
|
||||||
.attr("class", "note dashed");
|
.attr("data-text", "msg__curve")
|
||||||
|
|
||||||
snippets.A = new Snippet("notch", points.A);
|
|
||||||
snippets.B = new Snippet("notch", points.B);
|
|
||||||
snippets.C = new Snippet("notch", points.C);
|
|
||||||
snippets.Bcp2 = new Snippet("x", points.BCp2);
|
|
||||||
snippets.Ccp1 = new Snippet("x", points.CCp1);
|
|
||||||
|
|
||||||
paths.textLine = new Path()
|
|
||||||
.move(points.A)
|
|
||||||
.line(points.B)
|
|
||||||
.attr("data-text", "Line to point B")
|
|
||||||
.attr("data-text-class", "center text-xs");
|
.attr("data-text-class", "center text-xs");
|
||||||
|
|
||||||
paths.textCurve = new Path()
|
paths.curve_ = new Path()
|
||||||
.move(points.B)
|
.move(points.D)
|
||||||
.curve(points.BCp2, points.CCp1, points.C)
|
.curve_(points.ECp, points.E)
|
||||||
.attr(
|
.attr("data-text", "msg_curve_")
|
||||||
"data-text",
|
|
||||||
"Curve to point C, using BCp2 and CCp1 as control points"
|
|
||||||
)
|
|
||||||
.attr("data-text-class", "center text-xs");
|
.attr("data-text-class", "center text-xs");
|
||||||
|
|
||||||
paths.textClose = new Path()
|
paths.close = new Path()
|
||||||
.move(points.A)
|
.move(points.E)
|
||||||
.line(points.C)
|
.line(points.A)
|
||||||
.attr("data-text", "Close path")
|
.attr("data-text", "msg_close")
|
||||||
.attr("data-text-class", "center text-xs");
|
.attr("data-text-class", "center text-xs");
|
||||||
|
|
||||||
|
paths.example = paths.line
|
||||||
|
.join(paths.curve)
|
||||||
|
.join(paths._curve)
|
||||||
|
.join(paths.curve_)
|
||||||
|
.close();
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,5 @@ export default part => {
|
||||||
.attr("data-text-class", "text-xl center")
|
.attr("data-text-class", "text-xl center")
|
||||||
.attr("data-text-lineheight", 10);
|
.attr("data-text-lineheight", 10);
|
||||||
|
|
||||||
snippets.notch = new Snippet("x", points.anchor);
|
|
||||||
|
|
||||||
return box(part);
|
return box(part);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue