Skip to content

Commit b2fdcb1

Browse files
committed
Fix search highlight animation hanging when switching tabs
1 parent ee46d92 commit b2fdcb1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Source/CanvasViewport.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,8 @@ class CanvasViewport : public Component
765765
// Returns a one-shot move animation so you can cascade it with another animation
766766
Animator const& getMoveAnimation(Point<float> const pos)
767767
{
768-
static Animator moveAnimation = ValueAnimatorBuilder { }.build();
769-
770-
moveAnimation.complete();
771-
moveAnimation = ValueAnimatorBuilder { }
768+
moveChainAnimator.complete();
769+
moveChainAnimator = ValueAnimatorBuilder { }
772770
.withEasing(Easings::createEaseInOutCubic())
773771
.withDurationMs(300)
774772
.withValueChangedCallback([this](float v) {
@@ -783,7 +781,7 @@ class CanvasViewport : public Component
783781
animationStartScale = animationTargetScale = getViewScale();
784782
animationStartPos = getViewPosition();
785783
animationEndPos = pos;
786-
return moveAnimation;
784+
return moveChainAnimator;
787785
}
788786

789787
void setViewPosition(Point<float> newPos)
@@ -948,4 +946,6 @@ class CanvasViewport : public Component
948946
updateCanvasTransform();
949947
})
950948
.build();
949+
950+
Animator moveChainAnimator = ValueAnimatorBuilder { }.build(); // Special animator used to chain move animations with other animations
951951
};

0 commit comments

Comments
 (0)