Huge Aether performance fix; spells now scroll while debugging.

This commit is contained in:
Nick Winter 2014-01-24 08:01:00 -08:00
parent 9740fe0700
commit 9b9df12ea0
3 changed files with 11 additions and 1 deletions

View file

@ -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')}

View file

@ -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

View file

@ -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>")