fixed issue of multiple insertions due to multiple event handlers

This commit is contained in:
Dominik Kundel 2014-03-13 03:38:34 +01:00
parent c01d29907d
commit 5c97fea363

View file

@ -117,7 +117,8 @@ module.exports = Surface = class Surface extends CocoClass
@updateState true if @loaded
# TODO: synchronize both ways of choosing whether to show coords (@world via UI System or @options via World Select modal)
if @world.showCoordinates and @options.coords
@surfaceTextLayer.addChild new CoordinateDisplay camera: @camera
@coordinateDisplay = new CoordinateDisplay camera: @camera
@surfaceTextLayer.addChild @coordinateDisplay
@onFrameChanged()
Backbone.Mediator.publish 'surface:world-set-up'
@ -320,6 +321,10 @@ module.exports = Surface = class Surface extends CocoClass
@wasPlayingWhenCastingBegan = @playing
Backbone.Mediator.publish 'level-set-playing', { playing: false }
if @coordinateDisplay?
@surfaceTextLayer.removeChild @coordinateDisplay
@coordinateDisplay.destroy()
createjs.Tween.removeTweens(@surfaceLayer)
createjs.Tween.get(@surfaceLayer).to({alpha:0.9}, 1000, createjs.Ease.getPowOut(4.0))