Skip to content

Commit

Permalink
Make pan/zoom simultaneous (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lavesson authored Feb 19, 2025
1 parent 7c1348e commit 993ee7e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/young-dryers-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"victory-native": patch
---

Make it possible to zoom/pan simultaneously
13 changes: 9 additions & 4 deletions lib/src/cartesian/CartesianChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -658,18 +658,23 @@ function CartesianChartContent<

let composed = customGestures ?? Gesture.Race();
if (transformState) {
let gestures = Gesture.Simultaneous();

if (transformConfig?.pinch?.enabled ?? true) {
composed = Gesture.Race(
composed,
gestures = Gesture.Simultaneous(
gestures,
pinchTransformGesture(transformState, transformConfig?.pinch),
);
}

if (transformConfig?.pan?.enabled ?? true) {
composed = Gesture.Race(
composed,
gestures = Gesture.Simultaneous(
gestures,
panTransformGesture(transformState, transformConfig?.pan),
);
}

composed = Gesture.Race(composed, Gesture.Simultaneous(gestures));
}
if (chartPressState) {
composed = Gesture.Race(composed, panGesture);
Expand Down

0 comments on commit 993ee7e

Please sign in to comment.