Changeset - b95b97177de6
[Not reviewed]
default
0 2 0
Drew Perttula - 8 years ago 2017-05-11 05:30:51
drewp@bigasterisk.com
console time logs
Ignore-this: 2017a9621712d22de1c367c5f1da71f
2 files changed with 7 insertions and 0 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -64,25 +64,27 @@ class Handler
 
    @innerHandlers = [] # Handlers requested while this one was running
 
  
 
class AutoDependencies
 
  constructor: () ->
 
    @handlers = new Handler(null) # tree of all known Handlers (at least those with non-empty patterns). Top node is not a handler.
 
    @handlerStack = [@handlers] # currently running
 
    
 
  runHandler: (func, label) ->
 
    # what if we have this func already? duplicate is safe?
 

	
 
    h = new Handler(func, label)
 
    @handlerStack[@handlerStack.length - 1].innerHandlers.push(h)
 
    console.time("handler #{label}")
 
    @_rerunHandler(h, null)
 
    console.timeEnd("handler #{label}")
 
    
 
  _rerunHandler: (handler, patch) ->
 
    handler.patterns = []
 
    @handlerStack.push(handler)
 
    try
 
      handler.func(patch)
 
    catch e
 
      log('error running handler: ', e)
 
      # assuming here it didn't get to do all its queries, we could
 
      # add a *,*,*,* handler to call for sure the next time?
 
    finally
 
      #log('done. got: ', handler.patterns)
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -337,42 +337,45 @@ Polymer
 
    song:  { type: String, notify: true }
 
    zoomInX: { type: Object, notify: true }
 
    noteUris: { type: Array, notify: true }
 
    rowIndex: { type: Object, notify: true }
 
  observers: [
 
    'onGraph(graph, dia, setAdjuster, song, zoomInX)'
 
    'update(song, rowIndex)'
 
    'onZoom(zoomInX)'
 
    ]
 
  onGraph: ->
 
    @graph.runHandler(@update.bind(@), "row notes #{@rowIndex}")
 
  update: (patch) ->
 
    console.time('row update')
 

	
 
    U = (x) -> @graph.Uri(x)
 

	
 
    notesForThisRow = []
 
    i = 0
 
    for n in _.sortBy(@graph.objects(@song, U(':note')))
 
      if (i % ROW_COUNT) == @rowIndex
 
        notesForThisRow.push(n)
 
      i++
 

	
 
    updateChildren @, notesForThisRow, (newUri) =>
 
      child = document.createElement('light9-timeline-note')
 
      child.graph = @graph
 
      child.dia = @dia
 
      child.uri = newUri
 
      child.setAdjuster = @setAdjuster
 
      child.song = @song # could change, but all the notes will be rebuilt
 
      child.zoomInX = @zoomInX # missing binding; see onZoom
 
      return child      
 
    console.timeEnd('row update')
 

	
 
  onZoom: ->
 
    for e in @children
 
      e.zoomInX = @zoomInX
 

	
 

	
 
getCurvePoints = (graph, curve, xOffset) ->
 
  worldPts = []
 
  uris = graph.objects(curve, graph.Uri(':point'))
 
  for pt in uris
 
    v = $V([xOffset + graph.floatValue(pt, graph.Uri(':time')),
 
            graph.floatValue(pt, graph.Uri(':value'))])
 
@@ -557,40 +560,42 @@ Polymer
 
      setting = @graph.nextNumberedResource(@uri + 'set')
 
      patch = {delQuads: [], addQuads: [
 
        quad(@uri, U(':setting'), setting)
 
        quad(setting, U(':effectAttr'), U(':colorScale'))
 
        quad(setting, U(':value'), settingValue)
 
        ]}
 
      @graph.applyAndSendPatch(patch)
 
    
 
  addHandler: ->
 
    @graph.runHandler(@update.bind(@))
 
    
 
  update: ->
 
    console.time('attrs update')
 
    U = (x) -> @graph.Uri(x)
 
    @effect = @graph.uriValue(@uri, U(':effectClass'))
 
    @effectLabel = @effect.replace(/.*\//, '')
 
    @noteLabel = @uri.replace(/.*\//, '')
 

	
 
    @existingColorScaleSetting = null
 
    for setting in @graph.objects(@uri, U(':setting'))
 
      ea = @graph.uriValue(setting, U(':effectAttr'))
 
      value = @graph.stringValue(setting, U(':value'))
 
      if ea == U(':colorScale')
 
        @colorScaleFromGraph = value
 
        @colorScale = value
 
        @existingColorScaleSetting = setting
 
    if @existingColorScaleSetting == null
 
      @colorScaleFromGraph = '#ffffff'
 
      @colorScale = '#ffffff'
 
    console.timeEnd('attrs update')
 

	
 

	
 
  onDel: ->
 
    patch = {delQuads: [{subject: @song, predicate: @graph.Uri(':note'), object: @uri, graph: @song}], addQuads: []}
 
    @graph.applyAndSendPatch(patch)
 

	
 
    
 
class deleteme
 
  go: ->
 
    visible: { type: Boolean, notify: true }
 
    
 
    displayValue: { type: String }
0 comments (0 inline, 0 general)