Anchor recursivization

This commit is contained in:
Bán Dénes 2022-02-27 11:11:45 +01:00
parent b8c71bef0f
commit 6dc6b5d8e9
8 changed files with 119 additions and 45 deletions

View file

@ -156,7 +156,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer
// config sanitization
a.unexpected(config, name, ['type', 'anchor', 'nets', 'anchors', 'params'])
const type = a.in(config.type, `${name}.type`, Object.keys(footprint_types))
let anchor = anchor_lib.parse(config.anchor || {}, `${name}.anchor`, points, true, point)(units)
let anchor = anchor_lib.parse(config.anchor || {}, `${name}.anchor`, points, point)(units)
const nets = a.sane(config.nets || {}, `${name}.nets`, 'object')()
const anchors = a.sane(config.anchors || {}, `${name}.anchors`, 'object')()
const params = a.sane(config.params || {}, `${name}.params`, 'object')()
@ -189,7 +189,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer
parsed_params.xy = (x, y) => {
const new_anchor = anchor_lib.parse({
shift: [x, -y]
}, '_internal_footprint_xy', points, true, anchor)(units)
}, '_internal_footprint_xy', points, anchor)(units)
return `${new_anchor.x} ${-new_anchor.y}`
}
@ -224,7 +224,7 @@ const footprint = exports._footprint = (config, name, points, point, net_indexer
// parsing anchor-type parameters
parsed_params.anchors = {}
for (const [anchor_name, anchor_config] of Object.entries(prep.extend(fp.anchors || {}, anchors))) {
let parsed_anchor = anchor_lib.parse(anchor_config || {}, `${name}.anchors.${anchor_name}`, points, true, anchor)(units)
let parsed_anchor = anchor_lib.parse(anchor_config || {}, `${name}.anchors.${anchor_name}`, points, anchor)(units)
parsed_anchor.y = -parsed_anchor.y
parsed_params.anchors[anchor_name] = parsed_anchor
}