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) -> createAether: (thang) ->
aetherOptions = aetherOptions =
thisValue: thang.createUserContext() #thisValue: thang.createUserContext() # slooow, and not useful I guess?
problems: problems:
jshint_W040: {level: "ignore"} jshint_W040: {level: "ignore"}
aether_MissingThis: {level: (if thang.requiresThis then 'error' else 'warning')} 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() @setStatementRatio e.offsetX / @$el.find('.progress').width()
@updateTime() @updateTime()
@maintainIndexHover = true @maintainIndexHover = true
@updateScroll()
onProgressMouseOut: (e) -> onProgressMouseOut: (e) ->
@maintainIndexHover = false @maintainIndexHover = false
@ -73,6 +74,7 @@ module.exports = class SpellToolbarView extends View
lastTime = @statementTime lastTime = @statementTime
@setStatementIndex @statementIndex + delta @setStatementIndex @statementIndex + delta
@updateTime() if @statementIndex isnt lastTime @updateTime() if @statementIndex isnt lastTime
@updateScroll()
updateTime: -> updateTime: ->
@maintainIndexScrub = true @maintainIndexScrub = true
@ -80,6 +82,12 @@ module.exports = class SpellToolbarView extends View
@maintainIndexScrubTimeout = _.delay (=> @maintainIndexScrub = false), 500 @maintainIndexScrubTimeout = _.delay (=> @maintainIndexScrub = false), 500
Backbone.Mediator.publish 'level-set-time', time: @statementTime, scrubDuration: 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) -> setCallState: (callState, statementIndex, @callIndex, @metrics) ->
return if callState is @callState and statementIndex is @statementIndex return if callState is @callState and statementIndex is @statementIndex
return unless @callState = callState return unless @callState = callState

View file

@ -69,6 +69,7 @@ module.exports = class SpellView extends View
@ace.setShowPrintMargin false @ace.setShowPrintMargin false
@ace.setShowInvisibles false @ace.setShowInvisibles false
@ace.setBehavioursEnabled false @ace.setBehavioursEnabled false
@ace.setAnimatedScroll true
@toggleControls null, @writable @toggleControls null, @writable
@aceSession.selection.on 'changeCursor', @onCursorActivity @aceSession.selection.on 'changeCursor', @onCursorActivity
$(@ace.container).find('.ace_gutter').on 'click', '.ace_error, .ace_warning, .ace_info', @onAnnotationClick $(@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" markerRange.id = @aceSession.addMarker markerRange, clazz, "text"
@markerRanges.push markerRange @markerRanges.push markerRange
@aceSession.addGutterDecoration start.row, clazz if clazz is 'executing' @aceSession.addGutterDecoration start.row, clazz if clazz is 'executing'
null
onAnnotationClick: -> onAnnotationClick: ->
alertBox = $("<div class='alert alert-info fade in'>#{msg}</div>") alertBox = $("<div class='alert alert-info fade in'>#{msg}</div>")