mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-13 05:07:40 +02:00
[eric] canvas: the collapsed pill counter-zooms to at most 2x, not 4x; at 18% it dwarfed the cards beside it (Haik)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
84b65da9a6
commit
fc7d063206
@@ -1020,8 +1020,8 @@ const AgentCard: React.FC<Props> = ({
|
||||
tiled={false}
|
||||
/>
|
||||
</Box>
|
||||
{/* Map-pin rule: the capsule counter-zooms against the camera so its label stays legible zoomed out (12px at half zoom read as 6px). CSS zoom, not transform: it grows the LAYOUT box, so paint containment on the pill cannot clip it; at zoom 1 this is 1. */}
|
||||
<Box className="osw-pill-zoom" sx={{ zoom: 'max(1, min(4, calc(0.9 / var(--canvas-zoom, 1))))' }}>
|
||||
{/* Map-pin rule, capped at 2x: the capsule counter-zooms so its label stays legible to about half zoom, then shrinks with the board like everything else (at 4x it dwarfed the cards at 18%, Haik). CSS zoom, not transform: it grows the LAYOUT box, so paint containment on the pill cannot clip it; at zoom 1 this is 1. */}
|
||||
<Box className="osw-pill-zoom" sx={{ zoom: 'max(1, min(2, calc(0.9 / var(--canvas-zoom, 1))))' }}>
|
||||
<AgentNarratorPill
|
||||
label={pillLabel}
|
||||
running={pillRunning}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
// Haik, exp.9 at 18% zoom: the collapsed pill counter-zoomed up to 4x and dwarfed the cards it sat beside.
|
||||
test('the collapsed pill counter-zooms to at most twice its size', async () => {
|
||||
const fs = await import('node:fs');
|
||||
const url = await import('node:url');
|
||||
const here = url.fileURLToPath(new URL('.', import.meta.url));
|
||||
// The test runs from .test-build, so resolve the source next to it by name (both separators, Windows CI).
|
||||
const candidates = [
|
||||
here + 'AgentCard.tsx',
|
||||
here.replace(/([\\/])\.test-build([\\/])/, '$1src$2') + 'AgentCard.tsx',
|
||||
];
|
||||
const path = candidates.find((p) => fs.existsSync(p));
|
||||
assert.ok(path, `could not locate AgentCard.tsx from ${here}`);
|
||||
const src = fs.readFileSync(path as string, 'utf8');
|
||||
const rule = src.match(/zoom: 'max\(1, min\((\d+), calc\(0\.9 \/ var\(--canvas-zoom, 1\)\)\)\)'/);
|
||||
assert.ok(rule, 'the pill zoom rule must still be the one map-pin expression');
|
||||
assert.equal(Number(rule![1]), 2);
|
||||
});
|
||||
Reference in New Issue
Block a user