Skip to content

Commit 014e9dc

Browse files
Avoid weird pauses when moving labware to/from off-deck.
1 parent e5a1722 commit 014e9dc

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

components/src/hardware-sim/Deck/MoveLabwareOnDeck.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@ export function MoveLabwareOnDeck(
111111
? finalCoordinates
112112
: offDeckCoordinates
113113

114+
// The user can't see the splash animation if it happens off-deck.
115+
// Skip it so there's no pause where it looks like nothing is happening.
116+
const shouldAnimateSplashBeforeMove =
117+
animationInitialCoordinates !== offDeckCoordinates
118+
const shouldAnimateSplashAfterMove =
119+
animationFinalCoordinates !== offDeckCoordinates
120+
114121
const shouldReset = usePositionChangeReset(
115122
animationInitialCoordinates,
116123
animationFinalCoordinates
@@ -127,11 +134,13 @@ export function MoveLabwareOnDeck(
127134
},
128135
to: [
129136
{ deckOpacity: 1 },
130-
{ splashOpacity: 1 },
131-
{ splashOpacity: 0 },
137+
...(shouldAnimateSplashBeforeMove
138+
? [{ splashOpacity: 1 }, { splashOpacity: 0 }]
139+
: []),
132140
{ ...animationFinalCoordinates },
133-
{ splashOpacity: 1 },
134-
{ splashOpacity: 0 },
141+
...(shouldAnimateSplashAfterMove
142+
? [{ splashOpacity: 1 }, { splashOpacity: 0 }]
143+
: []),
135144
{ deckOpacity: 0 },
136145
],
137146
loop: true,
@@ -144,6 +153,8 @@ export function MoveLabwareOnDeck(
144153
// updates and not updates to the actual x/y/z components.
145154
...Object.values(animationInitialCoordinates),
146155
...Object.values(animationFinalCoordinates),
156+
shouldAnimateSplashBeforeMove,
157+
shouldAnimateSplashAfterMove,
147158
]
148159
)
149160

0 commit comments

Comments
 (0)