Skip to content

Commit b7f69fb

Browse files
fix(web): iPhone Duo fold buttons wait for a stand to land
Folding out of Laptop or Tent sends the rotation back and then the fold, and the Duo control queue holds one pending command. A fold pressed while the stand was still in flight replaced the queued rotation, and the rotation's frame depends on the display the stand settles on. The fold buttons now wait until the stand, or anything queued on it, has landed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent cbca0ee commit b7f69fb

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎apps/web/src/components/device/DeviceDuoControls.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export function DeviceDuoControls(props: {
4141
// Stands rotate the device. Folding out of one returns it to how it was held before.
4242
const [standVertical, setStandVertical] = useState(settledVertical);
4343
const phoneVertical = stand ? standVertical : settledVertical;
44+
// Folding out of a stand sends the rotation back, then the fold, and only one command can
45+
// wait. Hold the fold buttons until a stand, or anything queued on one, has landed; the
46+
// rotation must also be read in the frame of the display the stand settles on.
47+
const foldWaits = props.state.pending && (stand || props.state.requested?.control === "pose");
4448
const foldLabels = {
4549
closed: "Closed",
4650
half: phoneVertical ? "Book" : "Laptop",
@@ -52,14 +56,15 @@ export function DeviceDuoControls(props: {
5256
pressed: boolean,
5357
onClick: () => void,
5458
glyph: React.ReactNode,
59+
waits = false,
5560
) => (
5661
<Tooltip key={key}>
5762
<TooltipTrigger
5863
render={
5964
<Button
6065
size="icon"
6166
variant={pressed ? "secondary" : "ghost"}
62-
disabled={!props.enabled}
67+
disabled={!props.enabled || waits}
6368
aria-label={label}
6469
aria-pressed={pressed}
6570
data-pressed={pressed ? "" : undefined}
@@ -91,6 +96,7 @@ export function DeviceDuoControls(props: {
9196
props.onCommand({ control: "angle", value });
9297
},
9398
<DeviceDuoGlyph pose={id === "half" ? "book" : id} rotated={!phoneVertical} />,
99+
foldWaits,
94100
),
95101
)}
96102
</div>

0 commit comments

Comments
 (0)