mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Huge Aether performance fix; spells now scroll while debugging.
This commit is contained in:
parent
9740fe0700
commit
9b9df12ea0
3 changed files with 11 additions and 1 deletions
|
@ -56,7 +56,7 @@ module.exports = class Spell
|
|||
|
||||
createAether: (thang) ->
|
||||
aetherOptions =
|
||||
thisValue: thang.createUserContext()
|
||||
#thisValue: thang.createUserContext() # slooow, and not useful I guess?
|
||||
problems:
|
||||
jshint_W040: {level: "ignore"}
|
||||
aether_MissingThis: {level: (if thang.requiresThis then 'error' else 'warning')}
|
||||
|
|
|
@ -63,6 +63,7 @@ module.exports = class SpellToolbarView extends View
|
|||
@setStatementRatio e.offsetX / @$el.find('.progress').width()
|
||||
@updateTime()
|
||||
@maintainIndexHover = true
|
||||
@updateScroll()
|
||||
|
||||
onProgressMouseOut: (e) ->
|
||||
@maintainIndexHover = false
|
||||
|
@ -73,6 +74,7 @@ module.exports = class SpellToolbarView extends View
|
|||
lastTime = @statementTime
|
||||
@setStatementIndex @statementIndex + delta
|
||||
@updateTime() if @statementIndex isnt lastTime
|
||||
@updateScroll()
|
||||
|
||||
updateTime: ->
|
||||
@maintainIndexScrub = true
|
||||
|
@ -80,6 +82,12 @@ module.exports = class SpellToolbarView extends View
|
|||
@maintainIndexScrubTimeout = _.delay (=> @maintainIndexScrub = false), 500
|
||||
Backbone.Mediator.publish 'level-set-time', time: @statementTime, scrubDuration: 500
|
||||
|
||||
updateScroll: ->
|
||||
return unless statementStart = @callState?.statements?[@statementIndex]?.range[0]
|
||||
text = @ace.getValue()
|
||||
currentLine = text.substr(0, statementStart).split('\n').length - 1
|
||||
@ace.scrollToLine currentLine, true, true
|
||||
|
||||
setCallState: (callState, statementIndex, @callIndex, @metrics) ->
|
||||
return if callState is @callState and statementIndex is @statementIndex
|
||||
return unless @callState = callState
|
||||
|
|
|
@ -69,6 +69,7 @@ module.exports = class SpellView extends View
|
|||
@ace.setShowPrintMargin false
|
||||
@ace.setShowInvisibles false
|
||||
@ace.setBehavioursEnabled false
|
||||
@ace.setAnimatedScroll true
|
||||
@toggleControls null, @writable
|
||||
@aceSession.selection.on 'changeCursor', @onCursorActivity
|
||||
$(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick
|
||||
|
@ -461,6 +462,7 @@ module.exports = class SpellView extends View
|
|||
markerRange.id = @aceSession.addMarker markerRange, clazz, "text"
|
||||
@markerRanges.push markerRange
|
||||
@aceSession.addGutterDecoration start.row, clazz if clazz is 'executing'
|
||||
null
|
||||
|
||||
onAnnotationClick: ->
|
||||
alertBox = $("<div class='alert alert-info fade in'>#{msg}</div>")
|
||||
|
|
Loading…
Reference in a new issue