1
0
Fork 0

Make macros upToDate with documentation

This commit is contained in:
Wouter van Wageningen 2023-05-07 19:30:54 +00:00
parent 51b68a14cf
commit e95d2f0353
3 changed files with 8 additions and 8 deletions

View file

@ -1,8 +1,8 @@
// Export macros
export const crossboxMacros = {
crossbox: function (so, { points, Point, paths, Path, getId }) {
let id = getId()
let shiftFraction = 0.1
const id = getId()
const shiftFraction = 0.1
points[id + '_boxTopLeft'] = so.from.copy()
points[id + '_boxBottomRight'] = so.to.copy()
points[id + '_boxTopRight'] = new Point(so.to.x, so.from.y)
@ -44,7 +44,7 @@ export const crossboxMacros = {
.line(points[id + '_topCrossBL'])
.attr('class', 'lining dotted stroke-sm')
if (typeof so.text === 'string') {
points.textAnchor = points[id + '_boxTopLeft']
points[id + 'textAnchor'] = points[id + '_boxTopLeft']
.shiftFractionTowards(points[id + '_boxBottomRight'], 0.5)
.attr('data-text', so.text)
.attr('data-text-class', 'center')

View file

@ -30,8 +30,8 @@ export const pleatMacros = {
...so,
}
if (complete) {
points[so.prefix + 'From'] = so.from
points[so.prefix + 'To'] = so.to
points[so.prefix + 'From'] = so.from.copy()
points[so.prefix + 'To'] = so.to.copy()
points[so.prefix + 'FromIn'] = points[so.prefix + 'From'].shift(
so.from.shiftTowards(so.to, 0.1).angle(so.from) + 270,
so.margin * scale

View file

@ -45,9 +45,9 @@ export const sewtogetherMacros = {
if (null == so.middle) {
so.middle = so.from.shiftFractionTowards(so.to, 0.5)
}
points[so.prefix + 'From'] = so.from
points[so.prefix + 'Middle'] = so.middle
points[so.prefix + 'To'] = so.to
points[so.prefix + 'From'] = so.from.copy()
points[so.prefix + 'Middle'] = so.middle.copy()
points[so.prefix + 'To'] = so.to.copy()
points[so.prefix + 'FromCp'] = points[so.prefix + 'From'].shift(
points[so.prefix + 'From'].angle(points[so.prefix + 'Middle']) + 90,