Tweaks to the scrubber. Sliding it around no longer changes its play state; it only pauses playback if you click.

This commit is contained in:
Scott Erickson 2014-03-16 21:04:36 -07:00
parent 296a7584a6
commit c663bd74cf

View file

@ -165,13 +165,20 @@ module.exports = class PlaybackView extends View
$('.scrubber .progress', @$el).slider( $('.scrubber .progress', @$el).slider(
max: @sliderIncrements max: @sliderIncrements
animate: "slow" animate: "slow"
slide: (event, ui) => @scrubTo ui.value / @sliderIncrements slide: (event, ui) =>
start: (event, ui) => @clickingSlider = true @scrubTo ui.value / @sliderIncrements
@slideCount += 1
start: (event, ui) =>
@slideCount = 0
@wasPlaying = @playing
Backbone.Mediator.publish 'level-set-playing', {playing: false}
stop: (event, ui) => stop: (event, ui) =>
@actualProgress = ui.value / @sliderIncrements @actualProgress = ui.value / @sliderIncrements
Backbone.Mediator.publish 'playback:manually-scrubbed', ratio: @actualProgress Backbone.Mediator.publish 'playback:manually-scrubbed', ratio: @actualProgress
if @clickingSlider Backbone.Mediator.publish 'level-set-playing', {playing: @wasPlaying}
@clickingSlider = false if @slideCount < 3
@wasPlaying = false @wasPlaying = false
Backbone.Mediator.publish 'level-set-playing', {playing: false} Backbone.Mediator.publish 'level-set-playing', {playing: false}
@$el.find('.scrubber-handle').effect('bounce', {times: 2}) @$el.find('.scrubber-handle').effect('bounce', {times: 2})