Skip to content

Commit

Permalink
🐛 (timeline) show current time point correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed May 20, 2024
1 parent 0e85ff4 commit 758f5ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions packages/@ourworldindata/grapher/src/timeline/TimelineComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
isMobile,
debounce,
Bounds,
timeFromTimebounds,
DEFAULT_BOUNDS,
} from "@ourworldindata/utils"
import { observable, computed, action } from "mobx"
Expand Down Expand Up @@ -317,18 +316,19 @@ export class TimelineComponent extends React.Component<{

render(): JSX.Element {
const { manager, controller } = this
const { startTimeProgress, endTimeProgress, minTime, maxTime } =
controller
const { startHandleTimeBound, endHandleTimeBound } = manager
const {
startTimeProgress,
endTimeProgress,
minTime,
maxTime,
startTime,
endTime,
} = controller

const formattedMinTime = this.formatTime(minTime)
const formattedMaxTime = this.formatTime(maxTime)
const formattedStartTime = this.formatTime(
timeFromTimebounds(startHandleTimeBound, minTime, maxTime)
)
const formattedEndTime = this.formatTime(
timeFromTimebounds(endHandleTimeBound, minTime, maxTime)
)
const formattedStartTime = this.formatTime(startTime)
const formattedEndTime = this.formatTime(endTime)

return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ export class TimelineController {
return this.manager.times
}

private get startTime(): number {
get startTime(): number {
return findClosestTime(
this.timesAsc,
this.manager.startHandleTimeBound
)!
}

private get endTime(): number {
get endTime(): number {
return findClosestTime(this.timesAsc, this.manager.endHandleTimeBound)!
}

Expand Down

0 comments on commit 758f5ce

Please sign in to comment.