Skip to content

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

fix: slider overlap text labels in collapsed time widget (#3437)

Xun Lib4790f0f556d
diff --git a/src/components/src/common/time-range-slider.tsx b/src/components/src/common/time-range-slider.tsx
index 28dc2f17e..41f79f315 100644
--- a/src/components/src/common/time-range-slider.tsx
+++ b/src/components/src/common/time-range-slider.tsx
@@ -70,7 +70,7 @@ const StyledSliderContainer: IStyledComponent<
}
`;
-const ANIMATION_CONTROL_STYLE = {flex: 1};
+const ANIMATION_CONTROL_STYLE = {flex: 1, padding: 0, marginTop: 0};
TimeRangeSliderFactory.deps = [
PlaybackControlsFactory,
diff --git a/src/components/src/common/timeline-slider.tsx b/src/components/src/common/timeline-slider.tsx
index 3febc95d0..6e2eb6344 100644
--- a/src/components/src/common/timeline-slider.tsx
+++ b/src/components/src/common/timeline-slider.tsx
@@ -29,7 +29,8 @@ const SliderWrapper = styled.div`
display: flex;
position: relative;
flex-grow: 1;
- margin: 0 24px;
+ margin: 0 4px;
+ padding: 0 6px;
${media.palm`
margin: 0 ${SLIDER_MARGIN_PALM}px;
@@ -48,6 +49,8 @@ const StyledDomain = styled.div.attrs(props => ({
color: ${props => props.theme.titleTextColor};
font-weight: 400;
font-size: 10px;
+ flex-shrink: 0;
+ white-space: nowrap;
`;
const PROGRESS_BAR_HEIGHT = 8;
@@ -89,10 +92,20 @@ function TimelineSliderFactory() {
[isRanged, value]
);
+ const [displayValue0, displayValue1]: [number, number] = useMemo(() => {
+ if (!domain) {
+ return [value0, value1];
+ }
+
+ return [isRanged ? clamp(domain, value0) : value0, clamp(domain, value1)];
+ }, [domain, isRanged, value0, value1]);
+
const [onSlider0Change, onSlider1Change] = useMemo(() => {
if (!domain) return [noop, noop];
return [
- isRanged ? (newValue: number) => onThrottleUpdate([clamp(domain, newValue), value1]) : noop,
+ isRanged
+ ? (newValue: number) => onThrottleUpdate([clamp(domain, newValue), value1])
+ : noop,
isRanged
? (newValue: number) => onThrottleUpdate([value0, clamp(domain, newValue)])
: (newValue: number) =>
@@ -142,8 +155,8 @@ function TimelineSliderFactory() {
style={timelineSliderStyle}
onSlider0Change={onSlider0Change}
onSlider1Change={onSlider1Change}
- value0={value0}
- value1={value1}
+ value0={displayValue0}
+ value1={displayValue1}
marks={marks}
/>
</SliderWrapper>
diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.ts
index ad16df3e4..0271eb5c3 100644
--- a/src/localization/src/translations/en.ts
+++ b/src/localization/src/translations/en.ts
@@ -294,8 +294,8 @@ export default {
showLayer: 'Show layer',
hideFeature: 'Hide feature',
showFeature: 'Show feature',
- hide: 'hide',
- show: 'show',
+ hide: 'Hide',
+ show: 'Show',
removeLayer: 'Remove layer',
duplicateLayer: 'Duplicate layer',
zoomToLayer: 'Zoom to layer',
@@ -321,11 +321,11 @@ export default {
'3DMap': '3D Map',
animationByWindow: 'Moving Time Window',
animationByIncremental: 'Incremental Time Window',
- speed: 'speed',
- play: 'play',
- pause: 'pause',
- reset: 'reset',
- export: 'export',
+ speed: 'Speed',
+ play: 'Play',
+ pause: 'Pause',
+ reset: 'Reset',
+ export: 'Export',
timeLayerSync: 'Link with the layer timeline',
timeLayerUnsync: 'Unlink with the layer timeline',
syncTimelineStart: 'Start of current filter timeframe',