Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
feat(chapters): Start chapter on touch always from beginning
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-heimbuch committed Jul 8, 2017
1 parent 0202f50 commit 6997b64
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/components/tabs/chapters/ChapterEntry.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<template>
<div class="chapters--entry" :class="{active: chapter.active}"
<div class="chapters--entry"
:class="{active: chapter.active}"
:style="chapterStyle(theme, chapter, hover)"
@mouseover="onMouseOver"
@mouseleave="onMouseLeave">
<span class="index" v-if="hover" @click="onChapterPlayClick(index)">
<span class="index" v-if="hover" @click="onChapterPlayClick" @touchstart="onChapterPlayClick">
<PlayIcon size="12" :color="theme.tabs.body.icon"></PlayIcon>
</span>
<span class="index" v-else>{{index + 1}}</span>
<div class="chapter--progress"
@mouseout="onMouseOut"
@mousemove="onMouseMove"
@click="onChapterClick(index, ghost)">
@click="onChapterClick"
@touchstart="onChapterPlayClick">
<span class="title truncate">{{chapter.title}}</span>
<span class="timer">{{remainingTime(chapter, ghost, playtime)}}</span>
<span class="progress" :style="progressStyle(theme, chapter, playtime)"></span>
Expand Down Expand Up @@ -77,17 +79,6 @@
return secondsToTime(chapter.end - chapter.start)
}
const onChapterClick = (index, ghost) => {
store.dispatch(store.actions.setChapter(index))
store.dispatch(store.actions.updatePlaytime(ghost.time))
store.dispatch(store.actions.play())
}
const onChapterPlayClick = index => {
store.dispatch(store.actions.setChapter(index))
store.dispatch(store.actions.play())
}
export default {
data () {
return {
Expand All @@ -103,8 +94,6 @@
progressGhostStyle,
remainingTime,
onChapterClick,
onChapterPlayClick,
onMouseOut () {
store.dispatch(store.actions.disableGhostMode())
Expand All @@ -121,6 +110,21 @@
onMouseLeave () {
this.hover = false
},
onChapterClick(event) {
store.dispatch(store.actions.setChapter(this.index))
store.dispatch(store.actions.updatePlaytime(this.ghost.time))
store.dispatch(store.actions.play())
event.preventDefault()
return false
},
onChapterPlayClick(event) {
store.dispatch(store.actions.setChapter(this.index))
store.dispatch(store.actions.play())
event.preventDefault()
return false
}
},
components: {
Expand Down

0 comments on commit 6997b64

Please sign in to comment.