changeset 1468:b291b7be7332

refactor. try to remove connector turds (failed) Ignore-this: 5341ffd154c24e4c62f3d58bdc595b7
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 12 Jun 2016 11:35:25 +0000
parents 2ed61945d881
children 70959bb51ab3
files light9/web/timeline/timeline.coffee
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/timeline/timeline.coffee	Sun Jun 12 11:25:27 2016 +0000
+++ b/light9/web/timeline/timeline.coffee	Sun Jun 12 11:35:25 2016 +0000
@@ -15,6 +15,7 @@
     childByUri[e.uri] = e
 
   for uri in _.difference(childUris, newUris)
+    childByUri[uri].detached()
     childByUri[uri].remove()
   for uri in _.difference(newUris, childUris)
     parent.appendChild(makeChild(uri))
@@ -433,14 +434,20 @@
 
     if screenPts[3].e(1) - screenPts[0].e(1) < 100
       @clearAdjusters()
+      # also kill their connectors
       return
 
+    @makeCurveAdjusters(curveWidth, yForV, worldPts)
+    
+  makeCurveAdjusters: (curveWidth, yForV, worldPts) ->
+    U = (x) -> @graph.Uri(x)
+    
     @adjusterIds[@uri+'/offset'] = true
     @setAdjuster(@uri+'/offset', => new AdjustableFloatObject({
       graph: @graph
       subj: @uri
-      pred: @graph.Uri(':originTime')
-      ctx: @graph.Uri(@song)
+      pred: U(':originTime')
+      ctx: U(@song)
       getDisplayValue: (v, dv) => "o=#{dv}"
       getTargetPosForValue: (value) =>
         # display bug: should be working from pt[0].t, not from origin
@@ -457,8 +464,8 @@
             adj = new AdjustableFloatObject({
               graph: @graph
               subj: worldPts[pointNum].uri
-              pred: @graph.Uri(':time')
-              ctx: @graph.Uri(@song)
+              pred: U(':time')
+              ctx: U(@song)
               getTargetPosForValue: (value) =>
                 $V([@zoomInX(value),
                     yForV(worldPts[pointNum].e(2))])