diff --git a/App.tsx b/App.tsx index 8a44fce..74ae71f 100644 --- a/App.tsx +++ b/App.tsx @@ -857,7 +857,12 @@ export default function App() { if (!result.canceled && result.assets && result.assets.length > 0) { const asset = result.assets[0]; setLibraryImageUri(asset.uri); + // A new photo starts level: the previous photo's turn, fine straighten + // and AUTO horizon must not carry over. setPhotoRotation(0); + setPhotoStraighten(0); + setAutoHorizon(false); + setHorizonRoll(0); setMode('library'); // Picking from the camera is the other half of that switch (the camera // button is the way back), so the camera's edits must not land on the diff --git a/src/components/AdjustmentPanel.tsx b/src/components/AdjustmentPanel.tsx index c747d24..7c82278 100644 --- a/src/components/AdjustmentPanel.tsx +++ b/src/components/AdjustmentPanel.tsx @@ -279,6 +279,14 @@ export default function AdjustmentPanel({ if (!cropEnabled) setOpenGroup((g) => (g === 'crop' ? null : g)); }, [cropEnabled]); + // The strip a slider row was opened from: the "<" back button returns to it + // (STRAIGHTEN lives in ROTATE, COLOR TEMP in TEMP). Params without a parent + // strip just close the row. + const PARAM_GROUP: Partial> = { + straighten: 'rotate', + temperature: 'temp', + }; + const toggleParam = (key: string) => { haptic(); // One auxiliary row at a time: opening a slider closes any option strip. @@ -385,7 +393,12 @@ export default function AdjustmentPanel({ label: resetDirty ? 'RESET *' : 'RESET', active: false, amberValue: resetDirty, - onPress: onResetAll, + onPress: () => { + // RESET is a parameter switch too: drop any open row/strip with it. + setOpenGroup(null); + if (openParam) onOpenParamChange(null); + onResetAll(); + }, }); const choiceChips = ( @@ -593,6 +606,10 @@ export default function AdjustmentPanel({ } else if (v === 'straighten') { toggleParam('straighten'); } else if (v === 'auto') { + // AUTO is "snap to the sensor horizon": the manual angle is dropped + // first, so enabling it with a hand-set offset really levels the + // photo (re-tapping with it on still switches it back off). + if (!autoHorizon) onStraighten(0); onAutoHorizon(!autoHorizon); } else { onPickRotation(Number(v) as 0 | 90 | 180 | 270); @@ -843,7 +860,12 @@ export default function AdjustmentPanel({ 'fr', FRAMES.map((f) => ({ v: f.id, d: f.name.toUpperCase() })), selectedFrame, - (val) => onUpdateFrame(val as FrameId) + (val) => { + // Picking another frame is another parameter: the open slider + // row (STRAIGHTEN) goes with the previous one. + if (openParam) onOpenParamChange(null); + onUpdateFrame(val as FrameId); + } )} {cropEnabled && renderChip(groupChip('crop'))} {renderChip(rotateChip())} @@ -874,7 +896,12 @@ export default function AdjustmentPanel({ className="flex-row items-center border-b border-zinc-800/60 px-3 py-1.5" > toggleParam(openParamDef.key)} + onPress={() => { + // Back: close the row and bring back the strip it came from. + toggleParam(openParamDef.key); + const g = PARAM_GROUP[openParamDef.key]; + if (g) setOpenGroup(g); + }} className="mr-3 rounded-full border border-zinc-700 bg-titan px-3 py-2" activeOpacity={0.7} >