blob: a0c9bd74fe14a0697d9870037e048b8f52726799 (
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
27
28
|
import React from 'react'
import { ZOOM_STEPS } from 'app/constants'
import { timestamp } from 'app/utils'
const CursorRegion = ({ timeline }) => {
const { start_ts, zoom, cursor_region } = timeline
if (!cursor_region) return null
const secondsPerPixel = ZOOM_STEPS[zoom] * 0.1
const duration = cursor_region.b_ts - cursor_region.a_ts
const y = (cursor_region.a_ts - start_ts) / secondsPerPixel
const height = (duration) / secondsPerPixel
return (
<div
className='cursor_region'
style={{
top: y,
height,
}}
>
<div className='tickLabel'>
{timestamp(duration, 1, true)}
</div>
</div>
)
}
export default CursorRegion
|