1
0

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`)

View File

@ -0,0 +1,55 @@
points:
zones:
matrix:
columns:
only:
rows:
bottom:
top:
mirror:
ref: matrix_only_top
distance: 30
outlines:
exports:
test:
keys:
type: keys
side: both
size: 14
bound: false
rb:
type: rectangle
anchor:
- ref: mirror_matrix_only_bottom
# we do NOT specify `affect: xyr` here
- shift: [-3,-3]
orient: 30
size: [6,6]
operation: stack
rt:
type: rectangle
anchor:
- ref: mirror_matrix_only_top
affect: xyr
- shift: [-3,-3]
orient: 30
size: [6,6]
operation: stack
lb:
type: rectangle
anchor:
- ref: matrix_only_bottom
# again, no `affect: xyr`
- shift: [-3,-3]
orient: 30
size: [6,6]
operation: stack
lt:
type: rectangle
anchor:
- ref: matrix_only_top
affect: xyr
- shift: [-3,-3]
orient: 30
size: [6,6]
operation: stack

View File

@ -0,0 +1,434 @@
0
SECTION
2
HEADER
9
$INSUNITS
70
4
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
LTYPE
0
LTYPE
72
65
70
64
2
CONTINUOUS
3
______
73
0
40
0
0
ENDTAB
0
TABLE
2
LAYER
0
ENDTAB
0
ENDSEC
0
SECTION
2
ENTITIES
0
LINE
8
0
10
-7
20
-7
11
7
21
-7
0
LINE
8
0
10
7
20
-7
11
7
21
7
0
LINE
8
0
10
7
20
7
11
-7
21
7
0
LINE
8
0
10
-7
20
7
11
-7
21
-7
0
LINE
8
0
10
-7
20
12
11
7
21
12
0
LINE
8
0
10
7
20
12
11
7
21
26
0
LINE
8
0
10
7
20
26
11
-7
21
26
0
LINE
8
0
10
-7
20
26
11
-7
21
12
0
LINE
8
0
10
23
20
-7
11
37
21
-7
0
LINE
8
0
10
37
20
-7
11
37
21
7
0
LINE
8
0
10
37
20
7
11
23
21
7
0
LINE
8
0
10
23
20
7
11
23
21
-7
0
LINE
8
0
10
23
20
12
11
37
21
12
0
LINE
8
0
10
37
20
12
11
37
21
26
0
LINE
8
0
10
37
20
26
11
23
21
26
0
LINE
8
0
10
23
20
26
11
23
21
12
0
LINE
8
0
10
31.0980762
20
-4.0980762
11
36.2942286
21
-7.0980762
0
LINE
8
0
10
36.2942286
20
-7.0980762
11
39.2942286
21
-1.9019238
0
LINE
8
0
10
39.2942286
20
-1.9019238
11
34.0980762
21
1.0980762
0
LINE
8
0
10
34.0980762
20
1.0980762
11
31.0980762
21
-4.0980762
0
LINE
8
0
10
31.0980762
20
14.9019238
11
36.2942286
21
11.9019238
0
LINE
8
0
10
36.2942286
20
11.9019238
11
39.2942286
21
17.0980762
0
LINE
8
0
10
39.2942286
20
17.0980762
11
34.0980762
21
20.0980762
0
LINE
8
0
10
34.0980762
20
20.0980762
11
31.0980762
21
14.9019238
0
LINE
8
0
10
-1.0980762
20
-4.0980762
11
4.0980762
21
-1.0980762
0
LINE
8
0
10
4.0980762
20
-1.0980762
11
1.0980762
21
4.0980762
0
LINE
8
0
10
1.0980762
20
4.0980762
11
-4.0980762
21
1.0980762
0
LINE
8
0
10
-4.0980762
20
1.0980762
11
-1.0980762
21
-4.0980762
0
LINE
8
0
10
-1.0980762
20
14.9019238
11
4.0980762
21
17.9019238
0
LINE
8
0
10
4.0980762
20
17.9019238
11
1.0980762
21
23.0980762
0
LINE
8
0
10
1.0980762
20
23.0980762
11
-4.0980762
21
20.0980762
0
LINE
8
0
10
-4.0980762
20
20.0980762
11
-1.0980762
21
14.9019238
0
ENDSEC
0
EOF