Returning executed statement highlighting to deemphasized state when playback has ended.

This commit is contained in:
Nick Winter 2014-11-05 17:47:23 -08:00
parent aa9c3b5eaa
commit 36c753a828
4 changed files with 23 additions and 6 deletions

View file

@ -101,6 +101,9 @@ module.exports =
'playback:real-time-playback-ended': c.object {}
'playback:ended-changed': c.object {required: ['ended']},
ended: {type: 'boolean'}
'level:play-next-level': c.object {}
'level:toggle-playing': c.object {}

View file

@ -87,6 +87,10 @@
@include gradient-striped()
outline: 2px outset #0099ff
@include box-shadow(1px 1px 4px black)
&.playback-ended .executing
background-color: rgba(50, 255, 80, 0.65)
outline: 0
@include box-shadow(0 0 0px black)
.executed
background-color: rgba(110, 110, 110, 0.12)
.problem-marker-info
@ -96,9 +100,10 @@
.problem-marker-error
background-color: rgba(110, 45, 27, 0.25)
.executing:not(.ace_gutter-cell)
background-size: 40px 40px
@include animation(progress-bar-stripes 0.5s linear infinite)
&:not(.playback-ended)
.executing:not(.ace_gutter-cell)
background-size: 40px 40px
@include animation(progress-bar-stripes 0.5s linear infinite)
.ace_gutter-cell.executing:not(.ace_error):not(.ace_warning):not(.ace_info)
margin-left: 1px

View file

@ -250,13 +250,18 @@ module.exports = class LevelPlaybackView extends CocoView
$('.scrubber .progress-bar', @$el).css('width', "#{progress * 100}%")
updatePlayButton: (progress) ->
playButton = @$el.find('#play-button')
wasEnded = playButton.hasClass('ended')
if @worldCompletelyLoaded and progress >= 0.99 and @lastProgress < 0.99
$('#play-button').removeClass('playing').removeClass('paused').addClass('ended')
playButton.removeClass('playing').removeClass('paused').addClass('ended')
Backbone.Mediator.publish 'level:set-letterbox', on: false if @realTime
Backbone.Mediator.publish 'playback:real-time-playback-ended', {} if @realTime
if progress < 0.99 and @lastProgress >= 0.99
b = $('#play-button').removeClass('ended')
if @playing then b.addClass('playing') else b.addClass('paused')
playButton.removeClass('ended')
playButton.addClass(if @playing then 'playing' else 'paused')
isEnded = playButton.hasClass('ended')
if wasEnded isnt isEnded
Backbone.Mediator.publish 'playback:ended-changed', ended: isEnded
onRealTimePlaybackEnded: (e) ->
return unless @realTime

View file

@ -53,6 +53,7 @@ module.exports = class SpellView extends CocoView
'tome:spell-beautify': 'onSpellBeautify'
'tome:maximize-toggled': 'onMaximizeToggled'
'script:state-changed': 'onScriptStateChange'
'playback:ended-changed': 'onPlaybackEndedChanged'
events:
'mouseout': 'onMouseOut'
@ -845,6 +846,9 @@ module.exports = class SpellView extends CocoView
onScriptStateChange: (e) ->
@scriptRunning = if e.currentScript is null then false else true
onPlaybackEndedChanged: (e) ->
$(@ace?.container).toggleClass 'playback-ended', e.ended
checkRequiredCode: =>
return if @destroyed
source = @getSource().replace @singleLineCommentRegex(), ''