mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-04 09:53:55 -04:00
Fixed bugs in Tome spell views swapping.
This commit is contained in:
parent
a28ce55793
commit
068f798d58
2 changed files with 11 additions and 14 deletions
app
|
@ -28,6 +28,7 @@
|
||||||
width: 100%
|
width: 100%
|
||||||
|
|
||||||
.save-status
|
.save-status
|
||||||
|
display: none
|
||||||
position: absolute
|
position: absolute
|
||||||
top: 1%
|
top: 1%
|
||||||
right: 4%
|
right: 4%
|
||||||
|
|
|
@ -122,6 +122,7 @@ module.exports = class TomeView extends View
|
||||||
@spellTabView?.$el.after('<div id="' + @spellTabView.id + '"></div>').detach()
|
@spellTabView?.$el.after('<div id="' + @spellTabView.id + '"></div>').detach()
|
||||||
@spellTabView = null
|
@spellTabView = null
|
||||||
@removeSubView @spellPaletteView if @spellPaletteView
|
@removeSubView @spellPaletteView if @spellPaletteView
|
||||||
|
@spellPaletteView = null
|
||||||
@castButton?.$el.hide()
|
@castButton?.$el.hide()
|
||||||
@thangList?.$el.show()
|
@thangList?.$el.show()
|
||||||
|
|
||||||
|
@ -137,26 +138,21 @@ module.exports = class TomeView extends View
|
||||||
spell = @thangList.topSpellForThang thang
|
spell = @thangList.topSpellForThang thang
|
||||||
#spell = selectedThangSpells[0] # TODO: remember last selected spell for this thang
|
#spell = selectedThangSpells[0] # TODO: remember last selected spell for this thang
|
||||||
return @clearSpellView() unless spell?.canRead()
|
return @clearSpellView() unless spell?.canRead()
|
||||||
|
unless spell.view is @spellView
|
||||||
|
@clearSpellView()
|
||||||
|
@spellView = spell.view
|
||||||
|
@spellTabView = spell.tabView
|
||||||
|
@$el.find('#' + @spellView.id).after(@spellView.el).remove()
|
||||||
|
@$el.find('#' + @spellTabView.id).after(@spellTabView.el).remove()
|
||||||
|
@castButton.attachTo @spellView
|
||||||
|
@thangList.$el.hide()
|
||||||
|
Backbone.Mediator.publish 'tome:spell-shown', thang: thang, spell: spell
|
||||||
@spellList.setThangAndSpell thang, spell
|
@spellList.setThangAndSpell thang, spell
|
||||||
@spellView?.setThang thang
|
@spellView?.setThang thang
|
||||||
@spellTabView?.setThang thang
|
@spellTabView?.setThang thang
|
||||||
if @spellPaletteView?.thang isnt thang
|
if @spellPaletteView?.thang isnt thang
|
||||||
@spellPaletteView = @insertSubView new SpellPaletteView thang: thang
|
@spellPaletteView = @insertSubView new SpellPaletteView thang: thang
|
||||||
@spellPaletteView.toggleControls {}, spell.view.controlsEnabled # TODO: know when palette should have been disabled but didn't exist
|
@spellPaletteView.toggleControls {}, spell.view.controlsEnabled # TODO: know when palette should have been disabled but didn't exist
|
||||||
return if spell.view is @spellView
|
|
||||||
@clearSpellView()
|
|
||||||
@spellView = spell.view
|
|
||||||
@spellTabView = spell.tabView
|
|
||||||
@$el.find('#' + @spellView.id).after(@spellView.el).remove()
|
|
||||||
@$el.find('#' + @spellTabView.id).after(@spellTabView.el).remove()
|
|
||||||
@spellView.setThang thang
|
|
||||||
@spellTabView.setThang thang
|
|
||||||
@castButton.attachTo @spellView
|
|
||||||
@thangList.$el.hide()
|
|
||||||
# New, good event
|
|
||||||
Backbone.Mediator.publish 'tome:spell-shown', thang: thang, spell: spell
|
|
||||||
# Bad, old one for old scripts (TODO)
|
|
||||||
Backbone.Mediator.publish 'editor:tab-shown', thang: thang, methodName: spell.name
|
|
||||||
|
|
||||||
reloadAllCode: ->
|
reloadAllCode: ->
|
||||||
spell.view.reloadCode false for spellKey, spell of @spells
|
spell.view.reloadCode false for spellKey, spell of @spells
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue