Files
Harvey_Team_Page/design/project-links-2026-10-14/measure-glyph-bbox.cjs
T
FastD e352335822 Filter bar with hover layer, icon-only project links, design reports
Filters: the panel is a bar (status segment, always visible) plus a body that lives as a layer
under it - collapsed by default, expands on hover/focus/tap and never moves the case grid; the
reset control appears only when a facet is limited; width capped at 720px (measured 45px slack
against 477px before). Facet research report is included.

Links: project links in the mini card and in the project window are icon-only buttons with a
uniform slot (16px card / 18px window) and the accessible name in aria-label; studio contacts
(mail, VK, RuStore) live outside the cards.

Team and page: real photos from the public TITANS team page go to the member window while the
card keeps the mascot; the portfolio gains the First Step Radio card and genre values, the
process block became an individual-approach section, plus a cookie bar and a removable ticker.

Design folders under design/ keep reports, measurements, scripts and the .pen; probe and
before/after screenshot dumps, editor backups and caches are removed. Background-variant and
palette previews stay until the client picks one.
2026-10-15 05:50:52 +03:00

65 lines
3.6 KiB
JavaScript

/* Measure the tight bounding box of the brand glyph paths that go into the
* project-link buttons (inline SVG, currentColor).
*
* Why: a brand mark has to be cropped to its own silhouette, otherwise the icon
* sits off-centre inside the 18x18 button icon box (the source artwork carries
* wide empty margins: RuStore 88x88, VK 24x24).
*
* Output: console table + a JSON file next to the script.
* Run: NODE_PATH="$LOCALAPPDATA/hermes/hermes-agent/node_modules" \
* node design/project-links-2026-10-14/measure-glyph-bbox.cjs
*/
const { chromium } = require("playwright");
const fs = require("fs");
const path = require("path");
const EXE = process.env.CHROME_EXE ||
"C:/Users/deeen/AppData/Local/ms-playwright/chromium-1223/chrome-win64/chrome.exe";
/* VK: the letterform cut out of the official rounded-square tile (simple-icons v13).
* RuStore: the storefront mark inside the blue tile (Wikimedia Commons RuStore_logo.svg). */
const GLYPHS = {
vk: {
src: "simple-icons v13 vk.svg — inner (knock-out) subpath of the tile",
viewBox: "0 0 24 24",
d: "M6.79 7.3H4.05c.13 6.24 3.25 9.99 8.72 9.99h.31v-3.57c2.01.2 3.53 1.67 4.14 3.57h2.84c-.78-2.84-2.83-4.41-4.11-5.01 1.28-.74 3.08-2.54 3.51-4.98h-2.58c-.56 1.98-2.22 3.78-3.8 3.95V7.3H10.5v6.92c-1.6-.4-3.62-2.34-3.71-6.92Z",
},
rustore: {
src: "commons upload.wikimedia.org/e/e5/RuStore_logo.svg — white storefront path",
viewBox: "0 0 88 88",
d: "m51.2 16.1c-2.3-0.0226-4.3 1.83-4.3 4.25v5.17l-10.8-2.69c-0.336-0.0838-0.671-0.126-1-0.129-2.3-0.0226-4.3 1.83-4.3 4.25v5.15l-10.7-2.67c-2.69-0.67-5.3 1.36-5.3 4.12v28.7c0 2.44 1.66 4.56 4.03 5.15l17.1 4.26c2.69 0.67 5.3-1.36 5.3-4.12v-28.7c0-1.75-0.857-3.33-2.21-4.3-0.0216-0.0707-0.0167-0.149 0.0273-0.213 0.075-0.109 0.21-0.161 0.336-0.123 2.25 0.68 4.39 2.98 4.61 5.88l0.742 21.9c0.0191 0.734 0.509 1.36 1.2 1.59l6 1.49c2.69 0.67 5.3-1.36 5.3-4.12 0.0708-9.47 0.0504-19.1 0.0528-28.6 0-1.29-0.436-2.28-0.926-3-0.0794-0.12-0.163-0.238-0.252-0.352-0.107-0.136-0.224-0.265-0.344-0.391-0.179-0.188-0.37-0.367-0.576-0.527-0.0014-0.0011-0.0025-0.0028-0.0039-0.0039-0.0848-0.0852-0.109-0.218-0.0391-0.318 0.075-0.109 0.21-0.161 0.336-0.123 2.25 0.68 4.4 2.98 4.61 5.88l0.742 21.9c0.019 0.728 0.504 1.35 1.19 1.57l6.01 1.5c2.69 0.67 5.3-1.36 5.3-4.12v-28.7c0-2.44-1.66-4.56-4.03-5.15l-17.1-4.26c-0.336-0.0838-0.671-0.126-1-0.129z",
},
};
(async () => {
const browser = await chromium.launch({ executablePath: EXE });
const page = await browser.newPage();
await page.setContent("<body></body>");
const out = {};
for (const [name, g] of Object.entries(GLYPHS)) {
const box = await page.evaluate(({ viewBox, d }) => {
const NS = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(NS, "svg");
svg.setAttribute("viewBox", viewBox);
svg.setAttribute("width", "400");
svg.setAttribute("height", "400");
const p = document.createElementNS(NS, "path");
p.setAttribute("d", d);
svg.appendChild(p);
document.body.appendChild(svg);
const b = p.getBBox();
const r = { x: b.x, y: b.y, w: b.width, h: b.height };
svg.remove();
return r;
}, g);
out[name] = { src: g.src, sourceViewBox: g.viewBox, bbox: box };
console.log(`${name.padEnd(8)} source ${g.viewBox.padEnd(10)} bbox x=${box.x.toFixed(3)} y=${box.y.toFixed(3)} w=${box.w.toFixed(3)} h=${box.h.toFixed(3)} aspect=${(box.w / box.h).toFixed(3)}`);
}
const file = path.join(__dirname, "glyph-bbox.json");
fs.writeFileSync(file, JSON.stringify(out, null, 2) + "\n");
console.log("written:", file);
await browser.close();
})();