fix(frame): make the ROTATE strip behave on switching parameters

Four follow-ups on the strip added for the quarter turns / straighten / AUTO.

AUTO is "snap to the sensor horizon": it now drops the manual STRAIGHTEN offset when it is switched on, so enabling it after a hand-set angle really levels the photo instead of leaving the angle untouched (the chip goes from "ROTATE 0 · +22°" to "ROTATE · AUTO").

The "<" back button on a slider row returns to the strip the row was opened from (STRAIGHTEN to ROTATE, COLOR TEMP to TEMP) instead of closing everything, and picking another parameter — a frame chip or the global RESET — closes the open row, so the straighten slider no longer outlives the parameter it belongs to.

Opening another photo from the library resets the turn, the fine straighten angle and AUTO with it: a new photo starts level.
This commit is contained in:
2026-09-11 12:07:18 +07:00
parent 0ce561cb70
commit da48ceccb5
2 changed files with 35 additions and 3 deletions
+30 -3
View File
@@ -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<Record<string, GroupKey>> = {
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"
>
<TouchableOpacity
onPress={() => 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}
>