Fix comparison: read individual corner radii when independentCorners=true\n\nResult: {"status":"keep","total_diffs":99,"visibility":1,"text":0,"fills":10,"radius":14,"size":74,"unmatched":99}

This commit is contained in:
Danila Poyarkov 2026-03-14 13:15:04 +03:00
parent 8a9059479f
commit 3746d1ae90
2 changed files with 11 additions and 2 deletions

View file

@ -60,8 +60,16 @@ function collect(proxy: ReturnType<FigmaAPI['wrapNode']>, parentPath: string, si
const chars = (proxy as unknown as { characters?: string }).characters
if (proxy.type === 'TEXT' && chars) entry.text = chars
if (visibleFill) entry.fill = colorHex(visibleFill.color)
const cr = raw.cornerRadius as number | undefined
if (cr && cr > 0) entry.cr = Math.round(cr * 10) / 10
let cr = raw.cornerRadius as number
if (raw.independentCorners) {
const tl = raw.topLeftRadius as number ?? 0
const tr = raw.topRightRadius as number ?? 0
const br = raw.bottomRightRadius as number ?? 0
const bl = raw.bottomLeftRadius as number ?? 0
if (tl === tr && tr === br && br === bl) cr = tl
else cr = Math.max(tl, tr, br, bl)
}
if (cr > 0) entry.cr = Math.round(cr * 10) / 10
if (raw.clipsContent) entry.clip = true
ourNodes.set(path, entry)

View file

@ -1 +1,2 @@
{"type":"config","name":"Figma .fig import fidelity","metricName":"total_diffs","metricUnit":"","bestDirection":"lower"}
{"run":1,"commit":"8a90594","metric":246,"metrics":{"visibility":1,"text":0,"fills":10,"radius":161,"size":74,"unmatched":99},"status":"keep","description":"Baseline: 246 diffs (1 vis, 0 text, 10 fills, 161 radius, 74 size, 99 unmatched)","timestamp":1773482910363,"segment":0}