Fixed cast button click bug.

This commit is contained in:
Nick Winter 2014-02-12 20:45:29 -08:00
parent 04abe36837
commit adaedc240c

View file

@ -11,7 +11,6 @@ module.exports = class CastButtonView extends View
'tome:cast-spells': 'onCastSpells'
'god:world-load-progress-changed': 'onWorldLoadProgressChanged'
'god:new-world-created': 'onNewWorld'
'click .cast-button': -> Backbone.Mediator.publish 'tome:manual-cast', {}
'click .cast-options a': 'onCastOptionsClick'
constructor: (options) ->
@ -31,6 +30,7 @@ module.exports = class CastButtonView extends View
@castButton = $('.cast-button', @$el)
@castButtonGroup = $('.cast-button-group', @$el)
@castOptions = $('.autocast-delays', @$el)
@castButton.on 'click', @onCastButtonClick
# TODO: use a User setting instead of localStorage
delay = localStorage.getItem 'autocastDelay'
delay ?= 5000
@ -39,6 +39,9 @@ module.exports = class CastButtonView extends View
attachTo: (spellView) ->
@$el.detach().prependTo(spellView.toolbarView.$el).show()
onCastButtonClick: (e) ->
Backbone.Mediator.publish 'tome:manual-cast', {}
onCastOptionsClick: (e) ->
Backbone.Mediator.publish 'focus-editor'
@castButtonGroup.removeClass 'open'
@ -85,3 +88,4 @@ module.exports = class CastButtonView extends View
destroy: ->
super()
@castButton.off 'click', @onCastButtonClick