Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[fix] Fixed hex tile play animation (#2010)

Igor Dykhta36657380e796
diff --git a/src/components/src/common/animation-control/animation-control.tsx b/src/components/src/common/animation-control/animation-control.tsx
index 544bd60d9..18a948bbb 100644
--- a/src/components/src/common/animation-control/animation-control.tsx
+++ b/src/components/src/common/animation-control/animation-control.tsx
@@ -26,7 +26,7 @@ import Slider from '../slider/slider';
import {BottomWidgetInner} from '../styled-components';
import PlaybackControlsFactory from './playback-controls';
import FloatingTimeDisplayFactory from './floating-time-display';
-import {datetimeFormatter, snapToMarks} from '@kepler.gl/utils';
+import {datetimeFormatter, snapToMarks, toArray} from '@kepler.gl/utils';
import {DEFAULT_TIME_FORMAT} from '@kepler.gl/constants';
import {media} from '@kepler.gl/styles';
@@ -116,8 +116,9 @@ function AnimationControlFactory(
} = animationConfig;
const onSlider1Change = useCallback(
val => {
+ // TODO: can we move this logic into setLayerAnimationTimeUpdater
if (Array.isArray(timeSteps)) {
- setLayerAnimationTime(snapToMarks(val, timeSteps));
+ setLayerAnimationTime(snapToMarks(toArray(val)[0], timeSteps));
// TODO: merge slider in to avoid this step
} else if (val >= domain[0] && val <= domain[1]) {
diff --git a/src/components/src/common/animation-control/animation-controller.ts b/src/components/src/common/animation-control/animation-controller.ts
index d7efddf52..0a3c5b94c 100644
--- a/src/components/src/common/animation-control/animation-controller.ts
+++ b/src/components/src/common/animation-control/animation-controller.ts
@@ -230,6 +230,8 @@ function AnimationControllerFactory(): typeof AnimationControllerType {
const index = bisectLeft(steps, val);
const nextIdx = index >= steps.length - 1 ? 0 : index + 1;
+ // why do we need to pass an array of two objects? are we reading nextIdx at some point?
+ // _nextFrameByDomain only returns one value
return [steps[nextIdx], nextIdx];
}