Rebuild the metering overlay from the peeked values so compare restores the look

This commit is contained in:
2026-09-12 13:43:08 +07:00
parent 59e2719245
commit 3e9dcc40fb
+14 -8
View File
@@ -189,14 +189,20 @@ export default function App() {
const METER_HL_CLARITY = 3;
const clampAdj = (v: number) => Math.max(-10, Math.min(10, v));
const meteringActive = mode === 'camera' && meterMode === 'highlight';
// The overlay is built FROM the adjustments it is laid on, so the preview can
// ask for the pre-edit one while the finger holds the compare. Built from the
// live values it always was, it kept painting the EDITED look back over the
// recipe the peek had swapped in, and neither HIGHLIGHT nor SHADOW (nor EV,
// CONTRAST, CLARITY) ever came back.
const meteringOverlay = (a: ColorAdjustments): Partial<ColorAdjustments> => ({
exposureCompensation: clampAdj((a.exposureCompensation ?? 0) + METER_HL_EV),
highlight: clampAdj((a.highlight ?? 0) + METER_HL_HIGHLIGHT),
shadow: clampAdj((a.shadow ?? 0) + METER_HL_SHADOW),
contrast: clampAdj((a.contrast ?? 0) + METER_HL_CONTRAST),
clarity: clampAdj((a.clarity ?? 0) + METER_HL_CLARITY),
});
const meteringAdj: Partial<ColorAdjustments> | undefined = meteringActive
? {
exposureCompensation: clampAdj((adjustments.exposureCompensation ?? 0) + METER_HL_EV),
highlight: clampAdj((adjustments.highlight ?? 0) + METER_HL_HIGHLIGHT),
shadow: clampAdj((adjustments.shadow ?? 0) + METER_HL_SHADOW),
contrast: clampAdj((adjustments.contrast ?? 0) + METER_HL_CONTRAST),
clarity: clampAdj((adjustments.clarity ?? 0) + METER_HL_CLARITY),
}
? meteringOverlay(adjustments)
: undefined;
// Same overlay for the camera EXPORT — the EV dip included: EV is software
// only (no hardware AE bias anywhere), so preview and file must both apply it.
@@ -1448,7 +1454,7 @@ export default function App() {
onCropRectChange={setCropRect}
onSessionError={handleCameraSessionError}
onExposureChange={(ev) => handleUpdateAdjustments({ exposureCompensation: ev })}
meteringAdjustments={meteringAdj}
meteringAdjustments={meteringActive ? meteringOverlay(shownAdjustments) : undefined}
imageAdjustTarget={imageAdjustTarget}
onComparePeek={peekArmed ? handleComparePeek : undefined}
customWm={customWm}