summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/editor/timeline/components/cursor.component.js
blob: 4a94100f99b0f15e1cc878084ce7075ce363f1ec (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 'app/constants'
import { timestamp } from 'app/utils'

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