Base key-level defaults around u

This commit is contained in:
Bán Dénes 2021-07-18 16:26:30 +02:00
parent 9bdcd36d1a
commit 67e01ed4f9
3 changed files with 7 additions and 9 deletions

View file

@ -6,10 +6,6 @@
### Major
- For rectangles and other non-`keys` outline types, upgrade `ref` to full anchor support (including multi-anchors!)
- Base key-level defaults (and many other things) around u's
- Possibly breaking, as from here on out, changing `u` affects more than it did before
### Minor
- Global column-level attributes like spread
@ -19,7 +15,6 @@
- Add a way to globally enable/disable references (`ref_hide`)
- SVG input (for individual outlines, or even combinations parsed by line color, etc.)
- Look into gr_curve to possibly add beziers to the kicad conversion
- Support opting out of gluing altogether
- Support specifying keys/labels for the pcb section (not just blindly assuming all)
- Should add `p`, `pcx`, and `pcy` as units for padding calculations
- Add snappable line footprint
@ -66,6 +61,9 @@
- Units separated to their own block at the front
- Key-level `width` and `height` are supported during visualization
- This key-level example should probably be added from discord: https://discord.com/channels/714176584269168732/759825860617437204/773104093546676244
- Change outline fields to have their full anchor support documented
- Mention the ability to opt out of gluing!
- Key-level defaults are based around u's, not 19!
- Contribution guidelines
- including test commands (npm test, npm run coverage, --what switch, --dump switch)
- Changelog, Roadmap

View file

@ -45,7 +45,7 @@ const process = async (raw, debug=false, logger=()=>{}) => {
}
if (debug) {
results.points = points
results.demo = io.twodee(points_lib.visualize(points), debug)
results.demo = io.twodee(points_lib.visualize(points, units), debug)
}
logger('Generating outlines...')

View file

@ -312,11 +312,11 @@ exports.parse = (config, units) => {
return filtered
}
exports.visualize = (points) => {
exports.visualize = (points, units) => {
const models = {}
for (const [pname, p] of Object.entries(points)) {
const w = (p.meta.width * 19) - 1
const h = (p.meta.height * 19) - 1
const w = (p.meta.width * units.u) - 1
const h = (p.meta.height * units.u) - 1
const rect = u.rect(w, h, [-w/2, -h/2])
models[pname] = p.position(rect)
}