summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/align/components/timeline
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/views/align/components/timeline')
-rw-r--r--animism-align/frontend/views/align/components/timeline/playButton.component.js31
-rw-r--r--animism-align/frontend/views/align/components/timeline/playCursor.component.js7
-rw-r--r--animism-align/frontend/views/align/components/timeline/ticks.component.js11
-rw-r--r--animism-align/frontend/views/align/components/timeline/waveform.component.js6
4 files changed, 8 insertions, 47 deletions
diff --git a/animism-align/frontend/views/align/components/timeline/playButton.component.js b/animism-align/frontend/views/align/components/timeline/playButton.component.js
deleted file mode 100644
index 486eaee..0000000
--- a/animism-align/frontend/views/align/components/timeline/playButton.component.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import React, { Component } from 'react'
-// import { Link } from 'react-router-dom'
-import { bindActionCreators } from 'redux'
-import { connect } from 'react-redux'
-
-import actions from '../../../../actions'
-// import * as alignActions from '../align.actions'
-
-import { ZOOM_STEPS } from '../../constants'
-import { clamp } from '../../../../util'
-
-const PlayButton = ({ audio }) => {
- return (
- <div
- className={audio.playing ? 'playButton playing' : 'playButton paused'}
- onClick={() => {
- audio.playing ? actions.audio.pause() : actions.audio.play()
- }}
- />
- )
-}
-
-const mapStateToProps = state => ({
- audio: state.audio,
-})
-
-const mapDispatchToProps = dispatch => ({
- // alignActions: bindActionCreators({ ...alignActions }, dispatch),
-})
-
-export default connect(mapStateToProps, mapDispatchToProps)(PlayButton)
diff --git a/animism-align/frontend/views/align/components/timeline/playCursor.component.js b/animism-align/frontend/views/align/components/timeline/playCursor.component.js
index 71e6a3a..e03d212 100644
--- a/animism-align/frontend/views/align/components/timeline/playCursor.component.js
+++ b/animism-align/frontend/views/align/components/timeline/playCursor.component.js
@@ -24,13 +24,6 @@ const PlayCursor = ({ timeline, audio }) => {
)
}
-/*
- <div className='tickLabel'>
- {timestamp(cursor_ts, 1)}
- </div>
-
-*/
-
const mapStateToProps = state => ({
timeline: state.align.timeline,
audio: state.audio,
diff --git a/animism-align/frontend/views/align/components/timeline/ticks.component.js b/animism-align/frontend/views/align/components/timeline/ticks.component.js
index 72f9bd0..747fb7a 100644
--- a/animism-align/frontend/views/align/components/timeline/ticks.component.js
+++ b/animism-align/frontend/views/align/components/timeline/ticks.component.js
@@ -1,16 +1,15 @@
import React, { Component } from 'react'
-import { ZOOM_STEPS, ZOOM_LABEL_STEPS, ZOOM_TICK_STEPS } from '../../constants'
+import { ZOOM_STEPS, ZOOM_LABEL_STEPS, ZOOM_TICK_STEPS, INNER_HEIGHT } from '../../constants'
import { timestamp } from '../../../../util'
export default class Ticks extends Component {
render() {
let { start_ts, zoom, duration } = this.props.timeline
- const width = window.innerHeight
let secondsPerPixel = ZOOM_STEPS[zoom] * 0.1 // 0.1 sec / step
- let widthTimeDuration = width * secondsPerPixel // secs per pixel
+ let widthTimeDuration = INNER_HEIGHT * secondsPerPixel // secs per pixel
let timeMin = start_ts
let timeMax = Math.min(start_ts + widthTimeDuration, duration)
@@ -26,11 +25,11 @@ export default class Ticks extends Component {
let startOffset = pixelsPerLabel - (pixelMin % pixelsPerLabel)
let startTiming = (pixelMin + startOffset) * secondsPerPixel
- let labelCount = Math.ceil(width / pixelsPerLabel) + 1
+ let labelCount = Math.ceil(INNER_HEIGHT / pixelsPerLabel) + 1
let offset, timing, tickLabels = [], ticks = []
for (var i = -1; i < labelCount; i++) {
offset = i * pixelsPerLabel + startOffset
- if (offset > width) continue
+ if (offset > INNER_HEIGHT) continue
timing = i * secondsPerLabel + startTiming
if (timing > duration) {
break
@@ -63,7 +62,7 @@ export default class Ticks extends Component {
/>
)
}
- let tickCount = Math.ceil(width / pixelsPerTick) + 6
+ let tickCount = Math.ceil(INNER_HEIGHT / pixelsPerTick) + 6
for (var i = 0; i < tickCount; i += 1) {
offset = i * pixelsPerTick + startOffset - pixelsPerLabel
if (offset > durationOffset) {
diff --git a/animism-align/frontend/views/align/components/timeline/waveform.component.js b/animism-align/frontend/views/align/components/timeline/waveform.component.js
index 785b020..16ceaf6 100644
--- a/animism-align/frontend/views/align/components/timeline/waveform.component.js
+++ b/animism-align/frontend/views/align/components/timeline/waveform.component.js
@@ -6,7 +6,7 @@ import { connect } from 'react-redux'
import actions from '../../../../actions'
// import * as uploadActions from './upload.actions'
-import { WAVEFORM_SIZE, ZOOM_STEPS, ZOOM_LABEL_STEPS, ZOOM_TICK_STEPS } from '../../constants'
+import { WAVEFORM_SIZE, ZOOM_STEPS, ZOOM_LABEL_STEPS, ZOOM_TICK_STEPS, INNER_HEIGHT } from '../../constants'
class Waveform extends Component {
constructor(props){
@@ -23,12 +23,12 @@ class Waveform extends Component {
resize() {
const canvas = this.canvasRef.current
canvas.width = WAVEFORM_SIZE
- canvas.height = window.innerHeight
+ canvas.height = INNER_HEIGHT
}
draw() {
const canvas = this.canvasRef.current
const ctx = canvas.getContext('2d')
- const h = window.innerHeight
+ const h = INNER_HEIGHT
this.clearCanvas(ctx, h)
this.drawCurve(ctx, h)
}