Normalize bokeh preview sizing
This commit is contained in:
+7
-6
@@ -136,17 +136,18 @@ const filterDatasetForPlotType = (dataset, plotType) => {
|
||||
const PreviewPanel = ({ lensCurves }) => {
|
||||
const previewItems = lensCurves.map((curve) => {
|
||||
const infinityStat = curve.checkpointStats.find((stat) => !Number.isFinite(stat.separation));
|
||||
const blurPercent = infinityStat?.blurPercentOfDiagonal ?? 0;
|
||||
const blurMm = infinityStat?.blurMm ?? 0;
|
||||
|
||||
return {
|
||||
lens: curve.lens,
|
||||
blurPercent,
|
||||
blurMm,
|
||||
sensorDiagonal: curve.sensor?.diagonal ?? 1,
|
||||
colorIndex: curve.colorIndex,
|
||||
};
|
||||
});
|
||||
|
||||
const maxBlurPercent = previewItems.reduce((maxValue, item) => Math.max(maxValue, item.blurPercent), 0);
|
||||
const denominator = maxBlurPercent > 0 ? maxBlurPercent : 1;
|
||||
const maxBlurMm = previewItems.reduce((maxValue, item) => Math.max(maxValue, item.blurMm), 0);
|
||||
const denominator = maxBlurMm > 0 ? maxBlurMm : 1;
|
||||
|
||||
return (
|
||||
<div className="rounded-lg border border-slate-800 bg-slate-900/60 p-4">
|
||||
@@ -156,7 +157,7 @@ const PreviewPanel = ({ lensCurves }) => {
|
||||
) : (
|
||||
<div className="flex flex-wrap justify-center gap-4">
|
||||
{previewItems.map((item) => {
|
||||
const normalized = Math.min(item.blurPercent / denominator, 1);
|
||||
const normalized = Math.min(item.blurMm / denominator, 1);
|
||||
const diameter = Math.max(18, 30 + normalized * 70);
|
||||
const paletteColor = COLOR_PALETTE[item.colorIndex % COLOR_PALETTE.length];
|
||||
|
||||
@@ -177,7 +178,7 @@ const PreviewPanel = ({ lensCurves }) => {
|
||||
<div className="text-xs text-slate-200">
|
||||
<div className="font-medium text-slate-100">{item.lens.name}</div>
|
||||
<div className="text-[10px] uppercase tracking-wide text-slate-500">
|
||||
∞ blur {formatNumber(item.blurPercent, 2)}%
|
||||
∞ blur {formatNumber(item.blurMm, 2)} mm
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user