Fixed #1062. Added Item kind to level editor Thang filters.

This commit is contained in:
Nick Winter 2014-08-06 08:24:50 -07:00
parent 852dabc17a
commit 4d4e321265
5 changed files with 12 additions and 5 deletions

View file

@ -240,7 +240,7 @@ module.exports = class World
calculateBounds: -> calculateBounds: ->
bounds = {left: 0, top: 0, right: 0, bottom: 0} bounds = {left: 0, top: 0, right: 0, bottom: 0}
hasLand = _.some @thangs, 'isLand' hasLand = _.some @thangs, 'isLand'
for thang in @thangs when thang.isLand or not hasLand # Look at Lands only for thang in @thangs when thang.isLand or (not hasLand and thang.rectangle) # Look at Lands only
rect = thang.rectangle().axisAlignedBoundingBox() rect = thang.rectangle().axisAlignedBoundingBox()
bounds.left = Math.min(bounds.left, rect.x - rect.width / 2) bounds.left = Math.min(bounds.left, rect.x - rect.width / 2)
bounds.right = Math.max(bounds.right, rect.x + rect.width / 2) bounds.right = Math.max(bounds.right, rect.x + rect.width / 2)

View file

@ -110,6 +110,12 @@ $mobile: 1050px
.treema-node.treema-Wall .treema-node.treema-Wall
display: block display: block
&.hide-except-Item
.treema-node
display: none
.treema-node.treema-Item
display: block
&.hide-except-Misc &.hide-except-Misc
.treema-node .treema-node
display: none display: none

View file

@ -15,6 +15,8 @@ button.navbar-toggle.toggle.btn-primary#thangs-palette-toggle(type="button", dat
i.icon-globe i.icon-globe
button.btn.btn-primary(value="Doodad", title="Doodad") button.btn.btn-primary(value="Doodad", title="Doodad")
i.icon-leaf i.icon-leaf
button.btn.btn-primary(value="Item", title="Item")
i.icon-gift
button.btn.btn-primary(value="Misc", title="Misc") button.btn.btn-primary(value="Misc", title="Misc")
i.icon-question-sign i.icon-question-sign
.editor-nano-container.nano .editor-nano-container.nano

View file

@ -116,7 +116,7 @@ module.exports = class ThangsTabView extends CocoView
$(window).resize @onWindowResize $(window).resize @onWindowResize
@addThangsView = @insertSubView new AddThangsView world: @world, supermodel: @supermodel @addThangsView = @insertSubView new AddThangsView world: @world, supermodel: @supermodel
@buildInterface() # refactor to not have this trigger when this view re-renders? @buildInterface() # refactor to not have this trigger when this view re-renders?
if @thangsTreema.data.length if @thangsTreema.data.length
@$el.find('#canvas-overlay').css('display', 'none') @$el.find('#canvas-overlay').css('display', 'none')
onFilterExtantThangs: (e) -> onFilterExtantThangs: (e) ->
@ -500,7 +500,7 @@ class ThangNode extends TreemaObjectNode
s = "#{@data.thangType}" s = "#{@data.thangType}"
if isObjectID s if isObjectID s
unless name = ThangNode.thangNameMap[s] unless name = ThangNode.thangNameMap[s]
thangType = _.find @settings.supermodel.getModels(ThangType), (m) -> m.get('original') is s thangType = _.find @settings.supermodel.getModels(ThangType), (m) -> m.get('original') is s and m.get('kind')
name = ThangNode.thangNameMap[s] = thangType.get 'name' name = ThangNode.thangNameMap[s] = thangType.get 'name'
ThangNode.thangKindMap[s] = thangType.get 'kind' ThangNode.thangKindMap[s] = thangType.get 'kind'
kind = ThangNode.thangKindMap[s] kind = ThangNode.thangKindMap[s]

View file

@ -166,7 +166,7 @@ module.exports = class Handler
ids = ids.split(',') if _.isString ids ids = ids.split(',') if _.isString ids
ids = _.uniq ids ids = _.uniq ids
project = {name:1, original:1} project = {name:1, original:1, kind:1}
sort = {'version.major':-1, 'version.minor':-1} sort = {'version.major':-1, 'version.minor':-1}
makeFunc = (id) => makeFunc = (id) =>
@ -450,4 +450,3 @@ module.exports = class Handler
projection = {} projection = {}
projection[field] = 0 for field in model.privateProperties projection[field] = 0 for field in model.privateProperties
projection projection