       e.target = $(".add-thang-palette-icon[data-thang-type='" + thang + "']").get 0
     @selectAddThang e
 
-
 class ThangsNode extends TreemaNode.nodeMap.array
   valueClass: 'treema-array-replacement'
   getChildren: ->

    super options
    @world = options.world
    @thangTypes = @supermodel.getCollection new ThangTypeSearchCollection()  # should load depended-on Components, too
    @thangTypes.once 'sync', @onThangTypesLoaded
    @thangTypes.fetch()
    $(document).bind 'contextmenu', @preventDefaultContextMenu

    # just loading all Components for now: https://github.com/codecombat/codecombat/issues/405
    @componentCollection = @supermodel.getCollection new ComponentsCollection()
    @componentCollection.once 'sync', @onComponentsLoaded
    @componentCollection.fetch()

  onThangTypesLoaded: =>
    return if @destroyed
    @supermodel.addCollection @thangTypes
    @supermodel.populateModel model for model in @thangTypes.models

    @render()  # do it again but without the loading screen
    @onLevelLoaded level: @level if @level and not @startsLoading

  onComponentsLoaded: ->
    return if @destroyed
    @supermodel.addCollection @componentCollection
    @startsLoading = not @thangTypes.loaded
