Changeset - ea9e8f581eea
[Not reviewed]
default
0 2 0
Drew Perttula - 9 years ago 2016-06-13 21:00:02
drewp@bigasterisk.com
WIP optimization for note point dragging
Ignore-this: 2a7090064d70678dcbd4cdbbf435b57c
2 files changed with 26 insertions and 7 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -73,13 +73,13 @@ class AutoDependencies
 

	
 
    h = new Handler(func, label)
 
    @handlerStack[@handlerStack.length - 1].innerHandlers.push(h)
 
    @_rerunHandler(h)
 
    @_rerunHandler(h, null)
 
    
 
  _rerunHandler: (handler) ->
 
  _rerunHandler: (handler, patch) ->
 
    handler.patterns = []
 
    @handlerStack.push(handler)
 
    try
 
      handler.func()
 
      handler.func(patch)
 
    catch e
 
      log('error running handler: ', e)
 
      # assuming here it didn't get to do all its queries, we could
 
@@ -97,7 +97,7 @@ class AutoDependencies
 
      for child in toRun
 

	
 
        #child.innerHandlers = [] # let all children get called again
 
        @_rerunHandler(child)
 
        @_rerunHandler(child, patch)
 
        rerunInners(child)
 
    rerunInners(@handlers)
 

	
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -73,6 +73,10 @@ Polymer
 

	
 
    setInterval(@updateDebugSummary.bind(@), 100)
 

	
 
    #if anchor == loadtest
 
    #  add note and delete it repeatedly
 
    #  disconnect the graph, make many notes, drag a point over many steps, measure lag somewhere
 

	
 
  updateDebugSummary: ->
 
    elemCount = (tag) -> document.getElementsByTagName(tag).length
 
    @debug = "#{window.debug_zoomOrLayoutChangedCount} layout change,
 
@@ -332,7 +336,7 @@ Polymer
 
    ]
 
  onGraph: ->
 
    @graph.runHandler(@update.bind(@), "row notes #{@rowIndex}")
 
  update: ->
 
  update: (patch) ->
 
    U = (x) -> @graph.Uri(x)
 

	
 
    notesForThisRow = []
 
@@ -397,8 +401,23 @@ Polymer
 

	
 
  onUri: ->
 
    @graph.runHandler(@update.bind(@), "note updates #{@uri}")
 
    
 
  update: ->
 

	
 
  patchCouldAffectMe: (patch) ->
 
    if patch and patch.addQuads # sometimes patch is a polymer-sent value. @update is used as a listener too
 
      if patch.addQuads.length == patch.delQuads.length == 1
 
        add = patch.addQuads[0]
 
        del = patch.delQuads[0]
 
        if add.predicate == del.predicate == @graph.Uri(':time')
 
          if add.subject != @uri and del.subject != @uri
 
            log("i'm #{@uri}, cant be affected by #{ko.toJSON(patch)}")
 
            return false
 
    return true
 
      
 
            
 
  update: (patch) ->
 
    # not working yet
 
    #if @patchCouldAffectMe(patch)
 
    #  return
 
    if @isDetached?
 
      log('skipping update', @uri)
 
      return 
0 comments (0 inline, 0 general)