1
0

Independent per-point adjustment

This commit is contained in:
Bán Dénes 2023-05-20 22:02:19 +02:00
parent 9832489d41
commit 9f644c2e2b
11 changed files with 910 additions and 67 deletions

View File

@ -15,7 +15,7 @@
### Minor
- Support "direct" anchors, as in, recognize num arrays and parse them as x/y/r
- Add full anchor support to individual points (via `adjust`, probably)
- Add `origin` to zone-wide and global rotation in points
- Handle unnecessary (but seemingly consistent, so easy to confuse) `key` subfield of row-level overrides
- Allow footprints to access raw array/object fields from points with templating
- Include raw kicad footprint integrations

View File

@ -92,6 +92,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
orient: 0,
shift: [0, 0],
rotate: 0,
adjust: {},
width: units.$default_width,
height: units.$default_height,
padding: units.$default_padding,
@ -168,11 +169,17 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
// copy the current column anchor
let point = running_anchor.clone()
// apply per-key adjustments
// apply cumulative per-key adjustments
point.r += key.orient
point.shift(key.shift)
point.r += key.rotate
// commit running anchor
running_anchor = point.clone()
// apply independent adjustments
point = anchor_lib.parse(key.adjust, `${key.name}.adjust`, {}, point)(units)
// save new key
point.meta = key
points[key.name] = point
@ -182,7 +189,6 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
col_minmax[col_name].max = Math.max(col_minmax[col_name].max, point.y)
// advance the running anchor to the next position
running_anchor = point.clone()
running_anchor.shift([0, key.padding])
}

View File

@ -14,6 +14,7 @@ matrix:
- 0
- 0
rotate: 0
adjust: {}
width: 18
height: 18
padding: 19

View File

@ -14,6 +14,7 @@ matrix_col_row:
- 0
- 0
rotate: 0
adjust: {}
width: 18
height: 18
padding: 19

View File

@ -3,17 +3,21 @@ points:
matrix:
columns:
left:
middle.rows.home.adjust:
shift: [-2u, 0]
rotate: 45
right:
key:
stagger: 5
spread: 25
splay: 5
splay: -5
origin: [-9, -9]
rows:
top:
home:
orient: -90
shift: [0, 10]
rotate: 90
rows:
bottom:
home:
top:

View File

@ -145,35 +145,227 @@ LINE
8
0
10
14.4311966
-9
20
47
11
9
21
47
0
LINE
8
0
10
9
20
47
11
9
21
29
0
LINE
8
0
10
9
20
29
11
-9
21
29
0
LINE
8
0
10
-9
20
29
11
-9
21
47
0
LINE
8
0
10
10
20
9
11
28
21
9
0
LINE
8
0
10
28
20
9
11
28
21
-9
0
LINE
8
0
10
28
20
-9
11
10
21
-9
0
LINE
8
0
10
10
20
-9
11
10
21
9
0
LINE
8
0
10
-31.7279221
20
19
11
-19
21
31.7279221
0
LINE
8
0
10
-19
20
31.7279221
11
-6.2720779
21
19
0
LINE
8
0
10
-6.2720779
20
19
11
-19
21
6.2720779
0
LINE
8
0
10
-19
20
6.2720779
11
-31.7279221
21
19
0
LINE
8
0
10
10
20
47
11
28
21
47
0
LINE
8
0
10
28
20
47
11
28
21
29
0
LINE
8
0
10
28
20
29
11
10
21
29
0
LINE
8
0
10
10
20
29
11
10
21
47
0
LINE
8
0
10
36.5688034
20
13.9315046
11
32.3627012
54.500308
21
15.500308
12.3627012
0
LINE
8
0
10
32.3627012
54.500308
20
15.500308
12.3627012
11
33.9315046
52.9315046
21
-2.4311966
-5.5688034
0
LINE
8
0
10
33.9315046
52.9315046
20
-2.4311966
-5.5688034
11
16
35
21
-4
0
@ -181,11 +373,11 @@ LINE
8
0
10
16
35
20
-4
11
14.4311966
36.5688034
21
13.9315046
0
@ -193,49 +385,97 @@ LINE
8
0
10
22.7371845
48.1867095
20
33.7307613
31.9876465
11
40.6686891
66.1182141
21
35.2995647
30.4188431
0
LINE
8
0
10
40.6686891
66.1182141
20
35.2995647
30.4188431
11
42.2374925
64.5494107
21
17.3680601
12.4873385
0
LINE
8
0
10
42.2374925
64.5494107
20
17.3680601
12.4873385
11
24.3059879
46.6179061
21
15.7992567
14.0561419
0
LINE
8
0
10
24.3059879
46.6179061
20
15.7992567
14.0561419
11
22.7371845
48.1867095
21
33.7307613
31.9876465
0
LINE
8
0
10
49.8426686
20
50.9153458
11
67.7741732
21
49.3465424
0
LINE
8
0
10
67.7741732
20
49.3465424
11
66.2053698
21
31.4150378
0
LINE
8
0
10
66.2053698
20
31.4150378
11
48.2738652
21
32.9838412
0
LINE
8
0
10
48.2738652
20
32.9838412
11
49.8426686
21
50.9153458
0
ENDSEC
0

View File

@ -17,6 +17,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -28,18 +29,33 @@
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"home": {
"orient": -90,
"shift": [
0,
@ -53,6 +69,7 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -65,13 +82,13 @@
"row": "bottom",
"bind": [
10,
0,
10,
0,
0
]
}
},
"matrix_left_top": {
"matrix_left_home": {
"x": 0,
"y": 19,
"r": 0,
@ -89,29 +106,45 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "left_top",
"name": "matrix_left_top",
"colrow": "left_home",
"name": "matrix_left_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"home": {
"orient": -90,
"shift": [
0,
@ -125,6 +158,96 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "home",
"bind": [
10,
10,
10,
0
]
}
},
"matrix_left_top": {
"x": 0,
"y": 38,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "left_top",
"name": "matrix_left_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -143,17 +266,17 @@
]
}
},
"matrix_right_bottom": {
"x": 24.181350600000002,
"y": 5.750154,
"r": 5,
"matrix_middle_bottom": {
"x": 19,
"y": 0,
"r": 0,
"meta": {
"stagger": 5,
"spread": 25,
"splay": 5,
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
-9,
-9
0,
0
],
"orient": 0,
"shift": [
@ -161,29 +284,45 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_bottom",
"name": "matrix_right_bottom",
"colrow": "middle_bottom",
"name": "matrix_middle_bottom",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"home": {
"orient": -90,
"shift": [
0,
@ -197,6 +336,310 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "bottom",
"bind": [
10,
0,
0,
10
]
}
},
"matrix_middle_home": {
"x": -19,
"y": 19,
"r": 45,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_home",
"name": "matrix_middle_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "home",
"bind": [
10,
10,
10,
10
]
}
},
"matrix_middle_top": {
"x": 19,
"y": 38,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_top",
"name": "matrix_middle_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "top",
"bind": [
0,
10,
10,
10
]
}
},
"matrix_right_bottom": {
"x": 44.750154,
"y": 4.1813506,
"r": -5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_bottom",
"name": "matrix_right_bottom",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -205,14 +648,14 @@
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"home": {
"orient": -90,
"shift": [
0,
@ -232,14 +675,14 @@
]
}
},
"matrix_right_top": {
"x": 32.4873385,
"y": 25.549410700000003,
"r": 5,
"matrix_right_home": {
"x": 56.3680601,
"y": 22.237492500000002,
"r": -5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
@ -250,29 +693,45 @@
10
],
"rotate": 90,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_top",
"name": "matrix_right_top",
"colrow": "right_home",
"name": "matrix_right_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"home": {
"orient": -90,
"shift": [
0,
@ -286,6 +745,7 @@
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
@ -294,14 +754,120 @@
"key": {
"stagger": 5,
"spread": 25,
"splay": 5,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"top": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
},
"row": "home",
"bind": [
10,
0,
10,
10
]
}
},
"matrix_right_top": {
"x": 58.0240192,
"y": 41.1651918,
"r": -5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_top",
"name": "matrix_right_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,

View File

@ -17,6 +17,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -68,6 +69,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -119,6 +121,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -170,6 +173,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -17,6 +17,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -60,6 +61,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -17,6 +17,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -87,6 +88,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -150,6 +152,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -213,6 +216,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -283,6 +287,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -346,6 +351,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -409,6 +415,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -479,6 +486,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -542,6 +550,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -605,6 +614,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -675,6 +685,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -738,6 +749,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,

View File

@ -17,6 +17,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -85,6 +86,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -153,6 +155,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -223,6 +226,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -293,6 +297,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -363,6 +368,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
@ -437,6 +443,7 @@
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,