summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2021-03-11 14:38:02 +0100
committerJules Laplace <julescarbon@gmail.com>2021-03-11 14:38:02 +0100
commit37896f6960f8145a13e2943fbb0cde52da430d30 (patch)
tree40cb7ca2a6b470dc397dd0ba99998ad899a212b0 /animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js
parent64cd37eae81845dc5eaace17739a72299cfc6c67 (diff)
move sidebar and timeline out of align folder
Diffstat (limited to 'animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js')
-rw-r--r--animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js b/animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js
new file mode 100644
index 0000000..a0c9bd7
--- /dev/null
+++ b/animism-align/frontend/app/views/editor/timeline/components/cursorRegion.component.js
@@ -0,0 +1,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 \ No newline at end of file