Fixed cloning.

This commit is contained in:
Scott Erickson 2014-01-28 09:22:23 -08:00
parent a82a6a4188
commit e2db421d1c

View file

@ -220,7 +220,7 @@ module.exports = class ThangsTabView extends View
target = target.closest('.add-thang-palette-icon') target = target.closest('.add-thang-palette-icon')
wasSelected = target.hasClass 'selected' wasSelected = target.hasClass 'selected'
@$el.find('.add-thangs-palette .add-thang-palette-icon.selected').removeClass('selected') @$el.find('.add-thangs-palette .add-thang-palette-icon.selected').removeClass('selected')
@selectAddThangType(if wasSelected then null else target.attr 'data-thang-type') @selectAddThangType(if wasSelected then null else target.attr 'data-thang-type') unless key.alt or key.meta
target.addClass('selected') if @addThangType target.addClass('selected') if @addThangType
false false
@ -239,7 +239,7 @@ module.exports = class ThangsTabView extends View
@surface.spriteBoss.removeSprite @addThangSprite if @addThangSprite @surface.spriteBoss.removeSprite @addThangSprite if @addThangSprite
@addThangType = type @addThangType = type
if @addThangType if @addThangType
@surface.camera.lock() # hmm, this interfere with zooming @surface.camera.lock()
thang = @createAddThang() thang = @createAddThang()
@addThangSprite = @surface.spriteBoss.addThangToSprites thang, @surface.spriteBoss.spriteLayers["Floating"] @addThangSprite = @surface.spriteBoss.addThangToSprites thang, @surface.spriteBoss.spriteLayers["Floating"]
@addThangSprite.notOfThisWorld = true @addThangSprite.notOfThisWorld = true
@ -334,7 +334,7 @@ module.exports = class ThangsTabView extends View
@world.loadFromLevel serializedLevel, false @world.loadFromLevel serializedLevel, false
thang.isSelectable = not thang.isLand for thang in @world.thangs # let us select walls and such thang.isSelectable = not thang.isLand for thang in @world.thangs # let us select walls and such
@surface?.setWorld @world @surface?.setWorld @world
@selectAddThangType @addThangType if @addThangType # make another addThang sprite, since the World just refreshed @selectAddThangType @addThangType, @cloneSourceThang if @addThangType # make another addThang sprite, since the World just refreshed
Backbone.Mediator.publish 'level-thangs-changed', thangsData: @thangsTreema.data Backbone.Mediator.publish 'level-thangs-changed', thangsData: @thangsTreema.data
null null