const fs = require("fs") const { round, floor, ceil } = Math let boxes = {} let mode, name, x, y, w, h, cx, cy, rx, ry function flush() { if (mode === 'rect') { boxes[name] = [ x, y, w, h ] } if (mode === 'circle') { x = cx - rx y = cy - ry w = rx * 2 h = ry * 2 boxes[name] = [ x, y, w, h ] } x = y = w = h = cx = cy = rx = ry = 0 name = null } for (let line of fs.readFileSync("tools/layout.svg", "utf-8").split("\n")) { line = line.trim() if (line.startsWith("