1
0
Fork 0

constructions: Added Point.sitsRoughlyOn example

This commit is contained in:
Joost De Cock 2019-01-27 19:34:50 +01:00
parent bfe8dd55a2
commit 63fc1e2f66
7 changed files with 24 additions and 15 deletions

View file

@ -1,5 +1,3 @@
import { box } from "./shared";
export default part => {
let {
Point,

View file

@ -1,5 +1,3 @@
import { box } from "./shared";
export default part => {
let {
Point,

View file

@ -2,7 +2,6 @@ import { box } from "./shared";
export default part => {
let { Point, points, Snippet, snippets } = part.shorthand();
box(part); // Needed for demo as this part has no paths
points.anchor = new Point(50, 25)
.attr("data-text", "msg")
@ -11,5 +10,5 @@ export default part => {
snippets.notch = new Snippet("x", points.anchor);
return part;
return box(part);
};

View file

@ -3,8 +3,6 @@ import { box } from "./shared";
export default part => {
let { Point, points, Snippet, snippets } = part.shorthand();
box(part);
points.A = new Point(25, 25)
.attr("data-text", "Point A")
.attr("data-text-class", "text-xl")
@ -13,5 +11,5 @@ export default part => {
snippets.x = new Snippet("x", points.A);
return part;
return box(part);
};

View file

@ -3,8 +3,6 @@ import { box } from "./shared";
export default part => {
let { Point, points, Snippet, snippets } = part.shorthand();
box(part);
points.A = new Point(50, 25)
.attr("data-text", "Point A")
.attr("data-text-class", "text-xl");
@ -12,5 +10,5 @@ export default part => {
snippets.x = new Snippet("x", points.A);
return part;
return box(part);
};

View file

@ -4,8 +4,6 @@ export default part => {
// prettier-ignore
let {Point, points, Snippet, snippets, macro} = part.shorthand();
box(part);
let s;
for (let i = 0; i < 10; i++) {
points[`a${i}`] = new Point(i * 10, 40);
@ -16,5 +14,5 @@ export default part => {
snippets[`a${i}`] = new Snippet(s, points[`a${i}`]);
}
return part;
return box(part);
};

View file

@ -0,0 +1,20 @@
import { box } from "./shared";
export default part => {
// prettier-ignore
let {Point, points, Snippet, snippets, macro} = part.shorthand();
box(part);
let s;
for (let i = 0; i < 10; i++) {
points[`a${i}`] = new Point(i * 10, 40);
points[`b${i}`] = new Point(i * 10, i * 8);
if (points[`a${i}`].sitsRoughlyOn(points[`b${i}`])) s = "notch";
else s = "x";
snippets[`b${i}`] = new Snippet(s, points[`b${i}`]);
snippets[`a${i}`] = new Snippet(s, points[`a${i}`]);
}
return part;
};