Reenabled text events.

This commit is contained in:
Scott Erickson 2014-09-26 15:57:24 -07:00
parent b89a6c41a7
commit 8234db333e
2 changed files with 26 additions and 27 deletions

View file

@ -228,29 +228,28 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
delete @handledDisplayEvents[event] delete @handledDisplayEvents[event]
showTextEvents: -> showTextEvents: ->
# TODO: Add back text events, once this has been integrated with the Surface return unless @thang?.currentEvents
# return unless @thang?.currentEvents for event in @thang.currentEvents
# for event in @thang.currentEvents continue unless event.startsWith 'text-'
# continue unless event.startsWith 'text-' continue if @handledDisplayEvents[event]
# continue if @handledDisplayEvents[event] @handledDisplayEvents[event] = true
# @handledDisplayEvents[event] = true options = JSON.parse(event[5...])
# options = JSON.parse(event[5...]) label = new createjs.Text options.text, "bold #{options.size or 16}px Arial", options.color or '#FFF'
# label = new createjs.Text options.text, "bold #{options.size or 16}px Arial", options.color or '#FFF' shadowColor = {humans: '#F00', ogres: '#00F', neutral: '#0F0', common: '#0F0'}[@thang.team] ? '#000'
# shadowColor = {humans: '#F00', ogres: '#00F', neutral: '#0F0', common: '#0F0'}[@thang.team] ? '#000' label.shadow = new createjs.Shadow shadowColor, 1, 1, 3
# label.shadow = new createjs.Shadow shadowColor, 1, 1, 3 offset = @getOffset 'aboveHead'
# offset = @getOffset 'aboveHead' [label.x, label.y] = [@imageObject.x + offset.x - label.getMeasuredWidth() / 2, @imageObject.y + offset.y]
# [label.x, label.y] = [@imageObject.x + offset.x - label.getMeasuredWidth() / 2, @imageObject.y + offset.y] @options.textLayer.addChild label
# @options.floatingLayer.addChild label window.labels ?= []
# window.labels ?= [] window.labels.push label
# window.labels.push label label.alpha = 0
# label.alpha = 0 createjs.Tween.get(label)
# createjs.Tween.get(label) .to({y: label.y-2, alpha: 1}, 200, createjs.Ease.linear)
# .to({y: label.y-2, alpha: 1}, 200, createjs.Ease.linear) .to({y: label.y-12}, 1000, createjs.Ease.linear)
# .to({y: label.y-12}, 1000, createjs.Ease.linear) .to({y: label.y-22, alpha: 0}, 1000, createjs.Ease.linear)
# .to({y: label.y-22, alpha: 0}, 1000, createjs.Ease.linear) .call =>
# .call => return if @destroyed
# return if @destroyed @options.textLayer.removeChild label
# @options.floatingLayer.removeChild label
getBobOffset: -> getBobOffset: ->
return 0 unless @thang.bobHeight return 0 unless @thang.bobHeight

View file

@ -129,16 +129,16 @@ module.exports = LayerAdapter = class LayerAdapter extends CocoClass
@container.addChild children... @container.addChild children...
if @transformStyle is LayerAdapter.TRANSFORM_SURFACE_TEXT if @transformStyle is LayerAdapter.TRANSFORM_SURFACE_TEXT
for child in children for child in children
child.scaleX /= @scaleX child.scaleX /= @container.scaleX
child.scaleY /= @scaleY child.scaleY /= @container.scaleY
removeChild: (children...) -> removeChild: (children...) ->
@container.removeChild children... @container.removeChild children...
# TODO: Do we actually need to scale children that were removed? # TODO: Do we actually need to scale children that were removed?
if @transformStyle is LayerAdapter.TRANSFORM_SURFACE_TEXT if @transformStyle is LayerAdapter.TRANSFORM_SURFACE_TEXT
for child in children for child in children
child.scaleX *= @scaleX child.scaleX *= @container.scaleX
child.scaleY *= @scaleY child.scaleY *= @container.scaleY
#- Adding, removing children for WebGL layers. #- Adding, removing children for WebGL layers.