This commit is contained in:
Nick Winter 2014-01-06 14:53:21 -08:00
parent fa687c4c30
commit f53f20a6ad

View file

@ -42,6 +42,7 @@ module.exports = class ThangsTabView extends View
'sprite:dragged': 'onSpriteDragged' 'sprite:dragged': 'onSpriteDragged'
'sprite:mouse-up': 'onSpriteMouseUp' 'sprite:mouse-up': 'onSpriteMouseUp'
'sprite:double-clicked': 'onSpriteDoubleClicked' 'sprite:double-clicked': 'onSpriteDoubleClicked'
'surface:stage-mouse-down': 'onStageMouseDown'
constructor: (options) -> constructor: (options) ->
super options super options
@ -118,7 +119,13 @@ module.exports = class ThangsTabView extends View
@surface?.spriteBoss?.selectSprite null, null @surface?.spriteBoss?.selectSprite null, null
onSpriteMouseDown: (e) -> onSpriteMouseDown: (e) ->
#console.log "mouse down", e # Sprite clicks happen after stage clicks, but we need to know whether a sprite is being clicked.
clearTimeout @backgroundAddClickTimeout
onStageMouseDown: (e) ->
if @addThangSprite
# If we click on the background, we need to add @addThangSprite, but not if onSpriteMouseDown will fire.
@backgroundAddClickTimeout = _.defer => @onExtantThangSelected {}
onSpriteDragged: (e) -> onSpriteDragged: (e) ->
return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id return unless @selectedExtantThang and e.thang?.id is @selectedExtantThang?.id