Files
Febe/tools/schermate/passi/misure.js
T

9 lines
643 B
JavaScript

// Prints the boxes of the elements named in window.FEBE_MISURE (CSS selectors), for checking a layout against a mockup.
await new Promise((r) => setTimeout(r, 300));
const selectors = (window.FEBE_MISURE || new URLSearchParams(location.hash.slice(1)).get('m') || '.testa-blocco .destra').split('|');
return selectors.map((s) => [...document.querySelectorAll(s)].slice(0, 4).map((el) => {
const r = el.getBoundingClientRect();
const cs = getComputedStyle(el);
return `${s}: x=${Math.round(r.left)} y=${Math.round(r.top)} w=${Math.round(r.width)} h=${Math.round(r.height)} ml=${cs.marginLeft} d=${cs.display}`;
}).join('\n')).join('\n');