Added a workaround for Surface resize failure on realtime playback end that Maksym had seen.

This commit is contained in:
Nick Winter 2014-09-25 09:48:14 -07:00
parent 867279b6b8
commit 9ea24f4c74
2 changed files with 5 additions and 1 deletions

View file

@ -19,6 +19,8 @@ PointChooser = require './PointChooser'
RegionChooser = require './RegionChooser'
MusicPlayer = require './MusicPlayer'
resizeDelay = 500 # At least as much as $level-resize-transition-time.
module.exports = Surface = class Surface extends CocoClass
stage: null
@ -88,7 +90,7 @@ module.exports = Surface = class Surface extends CocoClass
@options = _.extend(@options, givenOptions) if givenOptions
@initEasel()
@initAudio()
@onResize = _.debounce @onResize, 500 # At least as much as $level-resize-transition-time.
@onResize = _.debounce @onResize, resizeDelay
$(window).on 'resize', @onResize
if @world.ended
_.defer => @setWorld @world
@ -545,6 +547,7 @@ module.exports = Surface = class Surface extends CocoClass
return unless @realTime
@realTime = false
@onResize()
_.delay @onResize, resizeDelay + 100 # Do it again just to be double sure that we don't stay zoomed in due to timing problems.
@spriteBoss.selfWizardSprite?.toggle true
@canvas.removeClass 'flag-color-selected'
if @previousCameraZoom

View file

@ -312,6 +312,7 @@ module.exports = class LevelPlaybackView extends CocoView
Backbone.Mediator.publish 'audio-player:play-sound', trigger: 'real-time-playback-end', volume: 1
onStopRealTimePlayback: (e) ->
Backbone.Mediator.publish 'level:set-letterbox', on: false
Backbone.Mediator.publish 'playback:real-time-playback-ended', {}
onSetDebug: (e) ->