Mercurial > code > home > repos > light9
changeset 1494:ea9e8f581eea
WIP optimization for note point dragging
Ignore-this: 2a7090064d70678dcbd4cdbbf435b57c
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 13 Jun 2016 21:00:02 +0000 |
parents | 4294ed82ee16 |
children | 243afbd7a117 |
files | light9/web/graph.coffee light9/web/timeline/timeline.coffee |
diffstat | 2 files changed, 26 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/web/graph.coffee Mon Jun 13 20:04:11 2016 +0000 +++ b/light9/web/graph.coffee Mon Jun 13 21:00:02 2016 +0000 @@ -73,13 +73,13 @@ 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 @@ for child in toRun #child.innerHandlers = [] # let all children get called again - @_rerunHandler(child) + @_rerunHandler(child, patch) rerunInners(child) rerunInners(@handlers)
--- a/light9/web/timeline/timeline.coffee Mon Jun 13 20:04:11 2016 +0000 +++ b/light9/web/timeline/timeline.coffee Mon Jun 13 21:00:02 2016 +0000 @@ -73,6 +73,10 @@ 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 @@ ] onGraph: -> @graph.runHandler(@update.bind(@), "row notes #{@rowIndex}") - update: -> + update: (patch) -> U = (x) -> @graph.Uri(x) notesForThisRow = [] @@ -397,8 +401,23 @@ 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