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