Skip to content

Commit

Permalink
fix: clockStop not working #467 #182 (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
William Lauzé authored and osdnk committed Jan 6, 2020
1 parent 2a48891 commit 1ea8cc3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Example/Interactable.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {
sub,
Clock,
Value,
onChange,
} = Animated;

const ANIMATOR_PAUSE_CONSECUTIVE_FRAMES = 10;
Expand Down Expand Up @@ -411,11 +412,15 @@ class Interactable extends Component {
}
const last = new Value(Number.MAX_SAFE_INTEGER);
const noMoveFrameCount = noMovementFrames[axis];
const testMovementFrames = cond(
eq(advance, last),
set(noMoveFrameCount, add(noMoveFrameCount, 1)),
[set(last, advance), set(noMoveFrameCount, 0)]
);
const testMovementFrames = block([
onChange(snapAnchor.x, set(last, Number.MAX_SAFE_INTEGER)),
onChange(snapAnchor.y, set(last, Number.MAX_SAFE_INTEGER)),
cond(
eq(advance, last),
set(noMoveFrameCount, add(noMoveFrameCount, 1)),
[set(last, advance), set(noMoveFrameCount, 0)]
),
]);
const step = cond(
eq(state, State.ACTIVE),
[
Expand All @@ -429,7 +434,6 @@ class Interactable extends Component {
cond(dt, dragBehaviors[axis]),
],
[
cond(clockRunning(clock), 0, startClock(clock)),
cond(dragging, [updateSnapTo, set(dragging, 0)]),
cond(dt, snapBehaviors[axis]),
testMovementFrames,
Expand Down

0 comments on commit 1ea8cc3

Please sign in to comment.