Outline progress and getting stuck
This commit is contained in:
parent
c0a7fb4552
commit
12f97a9171
4 changed files with 207 additions and 50 deletions
|
@ -64,6 +64,10 @@ const Point = exports.Point = class Point {
|
|||
let rect = u.rect(size, size, [-size/2, -size/2], this.meta.mirrored)
|
||||
return m.model.moveRelative(m.model.rotate(rect, this.r), this.p)
|
||||
}
|
||||
|
||||
position(model) {
|
||||
return m.model.moveRelative(m.model.rotate(model, this.r), this.p)
|
||||
}
|
||||
}
|
||||
|
||||
const dump = exports.dump = (points, opts={}) => {
|
||||
|
@ -122,16 +126,23 @@ const render_zone = (cols, rows, anchor=new Point(), reverse=false) => {
|
|||
// and we don't want to apply them twice...
|
||||
col_anchor.r = 0
|
||||
|
||||
for (const row of col.rows || rows) {
|
||||
// combine row data from zone-wide defs and col-specific defs
|
||||
const col_specific = col.rows || []
|
||||
const zone_wide = rows || []
|
||||
const actual_rows = []
|
||||
for (let i = 0; i < zone_wide.length && i < col_specific.length; ++i) {
|
||||
actual_rows.push(Object.assign({}, zone_wide[i], col_specific[i]))
|
||||
}
|
||||
|
||||
for (const row of actual_rows) {
|
||||
let point = col_anchor.clone()
|
||||
for (const r of rotations) {
|
||||
point.rotate(r.angle, r.origin)
|
||||
}
|
||||
point.r += col.angle || 0
|
||||
point.meta = {col, row}
|
||||
|
||||
const key = `${col.name}_${row.name}`
|
||||
points[key] = point
|
||||
const name = `${col.name}_${row.name}`
|
||||
point.meta = {col, row, name}
|
||||
points[name] = point
|
||||
|
||||
col_anchor.y += row.padding || 19
|
||||
}
|
||||
|
@ -185,12 +196,12 @@ exports.parse = (config) => {
|
|||
}
|
||||
|
||||
if (config.mirror) {
|
||||
let x = anchor(config.mirror, points).x
|
||||
x += (config.mirror.distance || 0) / 2
|
||||
let axis = anchor(config.mirror, points).x
|
||||
axis += (config.mirror.distance || 0) / 2
|
||||
const mirrored_points = {}
|
||||
for (const [name, p] of Object.entries(points)) {
|
||||
if (p.meta.col.asym == 'left' || p.meta.row.asym == 'left') continue
|
||||
const mp = p.clone().mirror(x)
|
||||
const mp = p.clone().mirror(axis)
|
||||
mp.meta.mirrored = true
|
||||
delete mp.meta.asym
|
||||
mirrored_points[`mirror_${name}`] = mp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue