Anchor affect bugfix, partially fixes #33

The mirroring part still has design inconsistencies because of rectangles being laid out by their bottom left corner, but as a breaking change, this will be addressed separately, later...
This commit is contained in:
Bán Dénes 2021-12-12 14:51:24 +01:00
parent 483f214bec
commit 38a8fc5be8
3 changed files with 496 additions and 2 deletions

View file

@ -45,7 +45,11 @@ const anchor = exports.parse = (raw, name, points={}, check_unexpected=true, def
}
}
if (raw.orient !== undefined) {
point.r += a.sane(raw.orient, `${name}.orient`, 'number')(units)
let angle = a.sane(raw.orient, `${name}.orient`, 'number')(units)
if (point.meta.mirrored) {
angle = -angle
}
point.r += angle
}
if (raw.shift !== undefined) {
let xyval = a.wh(raw.shift, `${name}.shift`)(units)
@ -62,8 +66,9 @@ const anchor = exports.parse = (raw, name, points={}, check_unexpected=true, def
point.r += angle
}
if (raw.affect !== undefined) {
const candidate = point
const candidate = point.clone()
point = default_point.clone()
point.meta = candidate.meta
let affect = raw.affect
if (a.type(affect)() == 'string') affect = affect.split('')
affect = a.strarr(affect, `${name}.affect`)