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 Apr 15, 2024
1 parent fff5caf commit 7566184
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 @@ -5,7 +5,6 @@ import {
isMobile,
debounce,
Bounds,
timeFromTimebounds,
DEFAULT_BOUNDS,
} from "@ourworldindata/utils"
import { observable, computed, action } from "mobx"
Expand Down Expand Up @@ -314,18 +313,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 7566184

Please sign in to comment.