mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Fixed color group saving in Thang editor.
This commit is contained in:
parent
d8ef2f8596
commit
e02431b26b
3 changed files with 11 additions and 0 deletions
|
@ -56,3 +56,6 @@ module.exports =
|
|||
|
||||
'editor:thang-type-kind-changed': c.object {required: ['kind']},
|
||||
kind: {type: 'string'}
|
||||
|
||||
'editor:thang-type-color-groups-changed': c.object {required: ['colorGroups']},
|
||||
colorGroups: {type: 'object'}
|
||||
|
|
|
@ -136,6 +136,7 @@ module.exports = class ThangTypeColorsTabView extends CocoView
|
|||
|
||||
onColorGroupsChanged: =>
|
||||
@thangType.set('colorGroups', @colorGroups.data)
|
||||
Backbone.Mediator.publish 'editor:thang-type-color-groups-changed', colorGroups: @colorGroups.data
|
||||
|
||||
onColorGroupSelected: (e, selected) =>
|
||||
@$el.find('#color-group-settings').toggle selected.length > 0
|
||||
|
|
|
@ -44,6 +44,7 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
'keyup .play-with-level-input': 'onPlayLevelKeyUp'
|
||||
|
||||
subscriptions:
|
||||
'editor:thang-type-color-groups-changed': 'onColorGroupsChanged'
|
||||
'editor:save-new-version': 'saveNewThangType'
|
||||
|
||||
# init / render
|
||||
|
@ -102,6 +103,11 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
onComponentsChanged: (components) =>
|
||||
@thangType.set 'components', components
|
||||
|
||||
onColorGroupsChanged: (e) ->
|
||||
@temporarilyIgnoringChanges = true
|
||||
@treema.set 'colorGroups', e.colorGroups
|
||||
@temporarilyIgnoringChanges = false
|
||||
|
||||
makeDot: (color) ->
|
||||
circle = new createjs.Shape()
|
||||
circle.graphics.beginFill(color).beginStroke('black').drawCircle(0, 0, 5)
|
||||
|
@ -383,6 +389,7 @@ module.exports = class ThangTypeEditView extends RootView
|
|||
@lastKind = data.kind
|
||||
|
||||
pushChangesToPreview: =>
|
||||
return if @temporarilyIgnoringChanges
|
||||
# TODO: This doesn't delete old Treema keys you deleted
|
||||
for key, value of @treema.data
|
||||
@thangType.set(key, value)
|
||||
|
|
Loading…
Reference in a new issue