Simplify the names in individual point "zones"
This commit is contained in:
parent
9ee099b16c
commit
2c18902e9f
6 changed files with 25 additions and 15 deletions
|
@ -206,6 +206,9 @@ exports.parse = (config, units) => {
|
||||||
// rendering zones
|
// rendering zones
|
||||||
for (let [zone_name, zone] of Object.entries(zones)) {
|
for (let [zone_name, zone] of Object.entries(zones)) {
|
||||||
|
|
||||||
|
// zone sanitization
|
||||||
|
zone = a.sane(zone || {}, `points.zones.${zone_name}`, 'object')()
|
||||||
|
|
||||||
// extracting keys that are handled here, not at the zone render level
|
// extracting keys that are handled here, not at the zone render level
|
||||||
const anchor = anchor_lib.parse(zone.anchor || {}, `points.zones.${zone_name}.anchor`, points)(units)
|
const anchor = anchor_lib.parse(zone.anchor || {}, `points.zones.${zone_name}.anchor`, points)(units)
|
||||||
const rotate = a.sane(zone.rotate || 0, `points.zones.${zone_name}.rotate`, 'number')(units)
|
const rotate = a.sane(zone.rotate || 0, `points.zones.${zone_name}.rotate`, 'number')(units)
|
||||||
|
@ -215,7 +218,16 @@ exports.parse = (config, units) => {
|
||||||
delete zone.mirror
|
delete zone.mirror
|
||||||
|
|
||||||
// creating new points
|
// creating new points
|
||||||
const new_points = render_zone(zone_name, zone, anchor, global_key, units)
|
let new_points = render_zone(zone_name, zone, anchor, global_key, units)
|
||||||
|
|
||||||
|
// simplifying the names in individual point "zones"
|
||||||
|
const new_keys = Object.keys(new_points)
|
||||||
|
const individual_key = `${zone_name}_default_default`
|
||||||
|
if (new_keys.length == 1 && new_keys[0] == individual_key) {
|
||||||
|
new_points[zone_name] = new_points[individual_key]
|
||||||
|
new_points[zone_name].meta.name = zone_name
|
||||||
|
delete new_points[individual_key]
|
||||||
|
}
|
||||||
|
|
||||||
// adjusting new points
|
// adjusting new points
|
||||||
for (const [new_name, new_point] of Object.entries(new_points)) {
|
for (const [new_name, new_point] of Object.entries(new_points)) {
|
||||||
|
|
|
@ -14,13 +14,13 @@ outlines:
|
||||||
type: circle
|
type: circle
|
||||||
anchor:
|
anchor:
|
||||||
ref:
|
ref:
|
||||||
- matrix_default_default
|
- matrix
|
||||||
- mirror_matrix_default_default
|
- mirror_matrix
|
||||||
radius: 15
|
radius: 15
|
||||||
outside_circles:
|
outside_circles:
|
||||||
type: circle
|
type: circle
|
||||||
anchor:
|
anchor:
|
||||||
ref: matrix_default_default
|
ref: matrix
|
||||||
shift: [-10, 10]
|
shift: [-10, 10]
|
||||||
radius: 5
|
radius: 5
|
||||||
mirror: true
|
mirror: true
|
|
@ -14,15 +14,15 @@ outlines:
|
||||||
type: polygon
|
type: polygon
|
||||||
points:
|
points:
|
||||||
- ref:
|
- ref:
|
||||||
- matrix_default_default
|
- matrix
|
||||||
- mirror_matrix_default_default
|
- mirror_matrix
|
||||||
shift: [0, 20]
|
shift: [0, 20]
|
||||||
- shift: [20, -40]
|
- shift: [20, -40]
|
||||||
- shift: [-40, 0]
|
- shift: [-40, 0]
|
||||||
outside_polys:
|
outside_polys:
|
||||||
type: polygon
|
type: polygon
|
||||||
points:
|
points:
|
||||||
- ref: matrix_default_default
|
- ref: matrix
|
||||||
shift: [-10, 15]
|
shift: [-10, 15]
|
||||||
- shift: [5, -10]
|
- shift: [5, -10]
|
||||||
- shift: [-10, 0]
|
- shift: [-10, 0]
|
||||||
|
|
|
@ -14,14 +14,14 @@ outlines:
|
||||||
type: rectangle
|
type: rectangle
|
||||||
anchor:
|
anchor:
|
||||||
ref:
|
ref:
|
||||||
- matrix_default_default
|
- matrix
|
||||||
- mirror_matrix_default_default
|
- mirror_matrix
|
||||||
shift: [0, sy/2]
|
shift: [0, sy/2]
|
||||||
size: [20, 40]
|
size: [20, 40]
|
||||||
outside_rects:
|
outside_rects:
|
||||||
type: rectangle
|
type: rectangle
|
||||||
anchor:
|
anchor:
|
||||||
ref: matrix_default_default
|
ref: matrix
|
||||||
shift: [-10, 10]
|
shift: [-10, 10]
|
||||||
size: 10
|
size: 10
|
||||||
mirror: true
|
mirror: true
|
|
@ -1,3 +1 @@
|
||||||
points:
|
points.zones.matrix:
|
||||||
zones:
|
|
||||||
matrix: {}
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"matrix_default_default": {
|
"matrix": {
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"r": 0,
|
"r": 0,
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
"padding": 19,
|
"padding": 19,
|
||||||
"skip": false,
|
"skip": false,
|
||||||
"asym": "both",
|
"asym": "both",
|
||||||
"name": "matrix_default_default",
|
"name": "matrix",
|
||||||
"col": {
|
"col": {
|
||||||
"rows": {},
|
"rows": {},
|
||||||
"key": {},
|
"key": {},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue