Skip to content

Commit

Permalink
pref: carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang committed May 11, 2023
1 parent 9752fe1 commit 2ec2ec3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/zarm/src/carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,18 @@ const Carousel = forwardRef<CarouselHTMLElement, CarouselProps>((props, ref) =>
const bind = useDrag(
(state) => {
let { activeIndex } = stateRef.current;
if (onMoving.current) {
if (activeIndex <= 0) {
onJumpTo(0);
} else if (activeIndex >= count - 1) {
onJumpTo(count - 1);
}
onMoving.current = false;
}
if (!state.intentional) {
return false;
};
intervalRef.current && window.clearInterval(intervalRef.current);
if (onMoving.current) {
return false;
}

const { offset, elapsedTime } = state;

Expand Down

0 comments on commit 2ec2ec3

Please sign in to comment.