summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/align/components/timeline/cursor.component.js
blob: f621b37e8ddad1942773ea118bec46a77a5b30a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React, { Component } from 'react'

import { ZOOM_STEPS } from '../../constants'
import { timestamp } from '../../../../util'

const Cursor = ({ timeline, annotation }) => {
  const { start_ts, zoom, cursor_ts, duration } = timeline
  const ts = annotation.start_ts || cursor_ts
  const secondsPerPixel = ZOOM_STEPS[zoom] * 0.1
  const y = (ts - start_ts) / secondsPerPixel
  return (
    <div
      className='cursor'
      style={{
        top: y,
      }}
    >
      <div className='line' />
      <div className='tickLabel'>
        {timestamp(ts, 1)}
      </div>
    </div>
  )
}

export default Cursor