Changeset - e00492e1c0b1
[Not reviewed]
default
0 3 0
Drew Perttula - 8 years ago 2017-06-10 10:53:52
drewp@bigasterisk.com
include some of the handler tree optimization code, turned off
Ignore-this: 4a965142bc4b194d7955fedc9ab41867
3 files changed with 24 insertions and 11 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -45,7 +45,7 @@ class AutoDependencies
 
    console.time("handler #{label}")
 
    @_rerunHandler(h, null)
 
    console.timeEnd("handler #{label}")
 
    @_logHandlerTree()
 
    #@_logHandlerTree()
 
    
 
  _rerunHandler: (handler, patch) ->
 
    handler.patterns = []
 
@@ -99,13 +99,13 @@ class AutoDependencies
 
  graphChanged: (patch) ->
 
    # SyncedGraph is telling us this patch just got applied to the graph.
 

	
 
    allPatchSubjs = @_allPatchSubjs(patch)
 
    #allPatchSubjs = @_allPatchSubjs(patch)
 
    
 
    rerunInners = (cur) =>
 
      toRun = cur.innerHandlers.slice()
 
      for child in toRun
 
        match = @_handlerIsAffected(child, allPatchSubjs)
 
        log('match', child.label, match)
 
        #match = @_handlerIsAffected(child, allPatchSubjs)
 
        #log('match', child.label, match)
 
        #child.innerHandlers = [] # let all children get called again
 
        
 
        @_rerunHandler(child, patch)
 
@@ -113,12 +113,15 @@ class AutoDependencies
 
    rerunInners(@handlers)
 

	
 
  askedFor: (s, p, o, g) ->
 
    return
 
    # SyncedGraph is telling us someone did a query that depended on
 
    # quads in the given pattern.
 
    current = @handlerStack[@handlerStack.length - 1]
 
    if current? and current != @handlers
 
      current.patterns.push([s, p, o, g])
 
      #log('push', s,p,o,g)
 
    #else
 
    #  console.trace('read outside runHandler')
 

	
 
class window.SyncedGraph
 
  # Main graph object for a browser to use. Syncs both ways with
 
@@ -189,15 +192,18 @@ class window.SyncedGraph
 
    if !Array.isArray(patch.addQuads) || !Array.isArray(patch.delQuads)
 
      throw new Error("corrupt patch: #{JSON.stringify(patch)}")
 

	
 
    @_validatePatch(patch)
 

	
 
    @_applyPatch(patch)
 
    @_client.sendPatch(patch) if @_client
 
    console.timeEnd('applyAndSendPatch')
 

	
 
  _validatePatch: (patch) ->
 
    for qs in [patch.addQuads, patch.delQuads]
 
      for q in qs
 
        if not q.graph?
 
          throw new Error("corrupt patch: #{JSON.stringify(q)}")
 

	
 
    @_applyPatch(patch)
 
    @_client.sendPatch(patch) if @_client
 
    console.timeEnd('applyAndSendPatch')
 
    
 
  _applyPatch: (patch) ->
 
    # In most cases you want applyAndSendPatch.
 
    # 
light9/web/timeline/adjustable.coffee
Show inline comments
 
@@ -104,6 +104,8 @@ class window.AdjustableFloatObject exten
 
    #   getValueForPos
 

	
 
    super(@config)
 
    if not @config.ctx?
 
      throw new Error("missing ctx")
 
    @config.graph.runHandler(@_syncValue.bind(@), "adj sync #{@config.subj}")
 

	
 
  _syncValue: () ->
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -400,11 +400,16 @@ Polymer
 
    selection: { type: Object, notify: true }
 
  observers: [
 
    'onGraph(graph, dia, setAdjuster, song, zoomInX)'
 
    'update(song, rowIndex)'
 
    'observedUpdate(song, rowIndex)'
 
    'onZoom(zoomInX)'
 
    ]
 
  onGraph: ->
 
    @graph.runHandler(@update.bind(@), "row notes #{@rowIndex}")
 

	
 
  observedUpdate: (song, rowIndex) ->
 
    @update() # old behavior
 
    #@graph.runHandler(@update.bind(@), "row notes #{@rowIndex}")
 

	
 
  update: (patch) ->
 
    U = (x) => @graph.Uri(x)
 

	
 
@@ -552,9 +557,9 @@ Polymer
 
    tMax = @graph.floatValue(worldPts[3].uri, @graph.Uri(':time'))
 
    tMax - tMin
 
    
 
  _makeCurvePointAdjusters: (yForV, worldPts) ->
 
  _makeCurvePointAdjusters: (yForV, worldPts, ctx) ->
 
    for pointNum in [0...worldPts.length]
 
      @_makePointAdjuster(yForV, worldPts, pointNum)
 
      @_makePointAdjuster(yForV, worldPts, pointNum, ctx)
 

	
 
  _makePointAdjuster: (yForV, worldPts, pointNum, ctx) ->
 
    U = (x) => @graph.Uri(x)
0 comments (0 inline, 0 general)