Restarting level now doesn't clear anything except code unless you hold down shift.

This commit is contained in:
Nick Winter 2014-11-19 15:24:50 -08:00
parent 6755c90f02
commit f310719cee
3 changed files with 9 additions and 3 deletions
app
schemas/subscriptions
views/play/level

View file

@ -35,7 +35,7 @@ module.exports =
'tome:toggle-spell-list': c.object {title: 'Toggle Spell List', description: 'Published when you toggle the dropdown for a thang\'s spells'}
'tome:reload-code': c.object {title: 'Reload Code', description: 'Published when you reset a spell to its original source', required: ['spell']},
'tome:reload-code': c.object {title: 'Reload Code', description: 'Published when you reset a spell to its original source', required: []},
spell: {type: 'object'}
'tome:palette-cleared': c.object {title: 'Palette Cleared', description: 'Published when the spell palette is about to be cleared and recreated.'},

View file

@ -6,4 +6,10 @@ module.exports = class ReloadLevelModal extends ModalView
template: template
events:
'click #restart-level-confirm-button': -> Backbone.Mediator.publish 'level:restart', {}
'click #restart-level-confirm-button': 'onClickRestart'
onClickRestart: (e) ->
if key.shift
Backbone.Mediator.publish 'level:restart', {}
else
Backbone.Mediator.publish 'tome:reload-code', {}

View file

@ -394,7 +394,7 @@ module.exports = class SpellView extends CocoView
@focus() if cast
onCodeReload: (e) ->
return unless e.spell is @spell
return unless e.spell is @spell or not e.spell
@reloadCode true
@ace.clearSelection()
_.delay (=> @ace?.clearSelection()), 500 # Make double sure this gets done (saw some timing issues?)