Skip to content

Commit 8916a0a

Browse files
committed
changed FlingGestureBasic to travel by a fixed distance
1 parent 977b2d6 commit 8916a0a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/docs-gesture-handler/static/examples/FlingGestureBasic.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ export default function App() {
5252
startTranslateX.value = event.x;
5353
},
5454
onActivate: (event) => {
55+
const directionMultiplier = event.x - startTranslateX.value > 0 ? 1 : -1;
5556
translateX.value = withTiming(
5657
clamp(
57-
translateX.value + event.x - startTranslateX.value,
58+
translateX.value + directionMultiplier * 100,
5859
containerWidth.value / -2 + 50,
5960
containerWidth.value / 2 - 50
6061
),

0 commit comments

Comments
 (0)