mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-11-04 03:17:00 -05:00 
			
		
		
		
	Merge pull request #777 from alexmaras/fix/chapter-seek-bar
Fix/chapter seek bar
This commit is contained in:
		
						commit
						ab6da3914b
					
				@ -85,7 +85,7 @@ export default {
 | 
				
			|||||||
      var perc = offsetX / this.trackWidth
 | 
					      var perc = offsetX / this.trackWidth
 | 
				
			||||||
      const baseTime = this.useChapterTrack ? this.currentChapterStart : 0;
 | 
					      const baseTime = this.useChapterTrack ? this.currentChapterStart : 0;
 | 
				
			||||||
      const duration = this.useChapterTrack ? this.currentChapterDuration : this.duration;
 | 
					      const duration = this.useChapterTrack ? this.currentChapterDuration : this.duration;
 | 
				
			||||||
      var time = baseTime + (perc * duration);
 | 
					      const time = baseTime + (perc * duration);
 | 
				
			||||||
      if (isNaN(time) || time === null) {
 | 
					      if (isNaN(time) || time === null) {
 | 
				
			||||||
        console.error('Invalid time', perc, time)
 | 
					        console.error('Invalid time', perc, time)
 | 
				
			||||||
        return
 | 
					        return
 | 
				
			||||||
@ -143,8 +143,10 @@ export default {
 | 
				
			|||||||
    mousemoveTrack(e) {
 | 
					    mousemoveTrack(e) {
 | 
				
			||||||
      var offsetX = e.offsetX
 | 
					      var offsetX = e.offsetX
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const duration = this.useChapterTrack ? this.currentChapterDuration : this.duration
 | 
					      const baseTime = this.useChapterTrack ? this.currentChapterStart : 0;
 | 
				
			||||||
      const time = (offsetX / this.trackWidth) * duration
 | 
					      const duration = this.useChapterTrack ? this.currentChapterDuration : this.duration;
 | 
				
			||||||
 | 
					      const progressTime = (offsetX / this.trackWidth) * duration;
 | 
				
			||||||
 | 
					      const totalTime = baseTime + progressTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (this.$refs.hoverTimestamp) {
 | 
					      if (this.$refs.hoverTimestamp) {
 | 
				
			||||||
        var width = this.$refs.hoverTimestamp.clientWidth
 | 
					        var width = this.$refs.hoverTimestamp.clientWidth
 | 
				
			||||||
@ -165,9 +167,9 @@ export default {
 | 
				
			|||||||
        this.$refs.hoverTimestampArrow.style.left = posLeft + 'px'
 | 
					        this.$refs.hoverTimestampArrow.style.left = posLeft + 'px'
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (this.$refs.hoverTimestampText) {
 | 
					      if (this.$refs.hoverTimestampText) {
 | 
				
			||||||
        var hoverText = this.$secondsToTimestamp(time)
 | 
					        var hoverText = this.$secondsToTimestamp(progressTime)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var chapter = this.chapters.find((chapter) => chapter.start <= time && time < chapter.end)
 | 
					        var chapter = this.chapters.find((chapter) => chapter.start <= totalTime && totalTime < chapter.end)
 | 
				
			||||||
        if (chapter && chapter.title) {
 | 
					        if (chapter && chapter.title) {
 | 
				
			||||||
          hoverText += ` - ${chapter.title}`
 | 
					          hoverText += ` - ${chapter.title}`
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user