Blur the music button after click so that subsequent space and enter keydown events do not trigger it. Fixes issue #306.

This commit is contained in:
Tay Yang Shun 2014-02-27 02:42:25 +08:00
parent bb76fb241c
commit b48a9fabc6

View file

@ -25,9 +25,7 @@ module.exports = class PlaybackView extends View
'click #debug-toggle': 'onToggleDebug' 'click #debug-toggle': 'onToggleDebug'
'click #grid-toggle': 'onToggleGrid' 'click #grid-toggle': 'onToggleGrid'
'click #edit-wizard-settings': 'onEditWizardSettings' 'click #edit-wizard-settings': 'onEditWizardSettings'
'click #music-button': -> 'click #music-button': 'onToggleMusic'
me.set('music', not me.get('music'))
me.save()
'click #zoom-in-button': -> Backbone.Mediator.publish('camera-zoom-in') unless @disabled 'click #zoom-in-button': -> Backbone.Mediator.publish('camera-zoom-in') unless @disabled
'click #zoom-out-button': -> Backbone.Mediator.publish('camera-zoom-out') unless @disabled 'click #zoom-out-button': -> Backbone.Mediator.publish('camera-zoom-out') unless @disabled
'click #volume-button': 'onToggleVolume' 'click #volume-button': 'onToggleVolume'
@ -206,6 +204,12 @@ module.exports = class PlaybackView extends View
Backbone.Mediator.publish 'level-set-volume', volume: volumes[newI] Backbone.Mediator.publish 'level-set-volume', volume: volumes[newI]
$(document.activeElement).blur() $(document.activeElement).blur()
onToggleMusic: (e) ->
e?.preventDefault()
me.set('music', not me.get('music'))
me.save()
$(document.activeElement).blur()
destroy: -> destroy: ->
me.off('change:music', @updateMusicButton, @) me.off('change:music', @updateMusicButton, @)
$(window).off('resize', @onWindowResize) $(window).off('resize', @onWindowResize)