diff --git a/light9/web/timeline-elements.html b/light9/web/timeline-elements.html
--- a/light9/web/timeline-elements.html
+++ b/light9/web/timeline-elements.html
@@ -56,7 +56,10 @@
+ graph="{{graph}}"
+ song="{{song}}"
+ parent-adjs="{{adjs}}"
+ zoom-in-x="{{zoomInX}}">
diff --git a/light9/web/timeline.coffee b/light9/web/timeline.coffee
--- a/light9/web/timeline.coffee
+++ b/light9/web/timeline.coffee
@@ -56,7 +56,7 @@ Polymer
@fullZoomX, @zoomInX, @viewState.cursor)
)
- @adjs = @makeZoomAdjs().concat(@persistDemo())
+ @adjs = @makeZoomAdjs()
@trackMouse()
@bindKeys()
@@ -130,31 +130,6 @@ Polymer
@animatedZoom(newCenter - visSeconds / 2,
newCenter + visSeconds / 2, zoomAnimSec)
- persistDemo: ->
- ctx = @graph.Uri(@song)
- adjs = []
- for n in [0..7]
- subj = @graph.Uri(':demoResource'+n)
- adjs.push(new AdjustableFloatObject({
- graph: @graph
- subj: subj
- pred: @graph.Uri(':startTime')
- ctx: ctx
- getTargetTransform: (value) => $V([@zoomInX(value), 600])
- getValueForPos: (pos) => @zoomInX.invert(pos.e(1))
- getSuggestedTargetOffset: () => $V([0, -80])
- }))
- adjs.push(new AdjustableFloatObject({
- graph: @graph
- subj: subj
- pred: @graph.Uri(':endTime')
- ctx: ctx
- getTargetTransform: (value) => $V([@zoomInX(value), 600])
- getValueForPos: (pos) => @zoomInX.invert(pos.e(1))
- getSuggestedTargetOffset: () => $V([0, -80])
- }))
- return adjs
-
makeZoomAdjs: ->
yMid = @$.audio.offsetTop + @$.audio.offsetHeight / 2
dur = @viewState.zoomSpec.duration
@@ -231,14 +206,12 @@ Polymer
ready: ->
onUri: ->
- @graph.subscribe(@uri, null, null, @update.bind(@))
+ @graph.runHandler(@update.bind(@))
update: ->
# update our note DOM and SVG elements based on the graph
U = (x) -> @graph.Uri(x)
- return if !@zoomInX
try
-
worldPts = [] # (song time, value)
originTime = @graph.floatValue(@uri, U(':originTime'))
@@ -264,8 +237,32 @@ Polymer
Polymer
is: "light9-timeline-adjusters"
properties:
- adjs: { type: Array },
+ adjs: { type: Array }, # our computed list
+ parentAdjs: { type: Array }, # incoming requests
+ graph: { type: Object, notify: true }
+ song: { type: String, notify: true }
+ zoomInX: { type: Object, notify: true }
dia: { type: Object }
+ observers: [
+ 'update(parentAdjs, graph, song, dia)'
+ 'onGraph(graph, song)'
+ ]
+ onGraph: (graph, song, zoomInX) ->
+ graph.runHandler(@update.bind(@))
+ update: (parentAdjs, graph, song, dia) ->
+ U = (x) -> @graph.Uri(x)
+ @adjs = @parentAdjs.slice()
+ for note in @graph.objects(@song, U(':note'))
+ @push('adjs', new AdjustableFloatObject({
+ graph: @graph
+ subj: note
+ pred: @graph.Uri(':originTime')
+ ctx: @graph.Uri(@song)
+ getTargetTransform: (value) => $V([@zoomInX(value), 600])
+ getValueForPos: (pos) => @zoomInX.invert(pos.e(1))
+ getSuggestedTargetOffset: () => $V([0, -80])
+ }))
+
updateAllCoords: ->
for elem in @querySelectorAll('light9-timeline-adjuster')
elem.updateDisplay()
diff --git a/show/dance2016/song1.n3 b/show/dance2016/song1.n3
--- a/show/dance2016/song1.n3
+++ b/show/dance2016/song1.n3
@@ -4,35 +4,11 @@
@prefix xml: .
@prefix xsd: .
-ns1:demoResource0 ns1:endTime 120.3 ;
- ns1:startTime 3.421 .
-
-ns1:demoResource1 ns1:endTime 16 ;
- ns1:startTime 6.791 .
-
-ns1:demoResource2 ns1:endTime 60 ;
- ns1:startTime 38 .
-
-ns1:demoResource3 ns1:endTime 62.149 ;
- ns1:startTime 56 .
-
-ns1:demoResource4 ns1:endTime 78.599 ;
- ns1:startTime 73 .
-
-ns1:demoResource5 ns1:endTime 105 ;
- ns1:startTime 87.573 .
-
-ns1:demoResource6 ns1:endTime 113.942 ;
- ns1:startTime 109.328 .
-
-ns1:demoResource7 ns1:endTime 140.711 ;
- ns1:startTime 130.447 .
-
ns1:note .
a ns1:Note ;
ns1:curve ;
- ns1:originTime 5 .
+ ns1:originTime 29.932 .
a ns1:Curve ;
ns1:attr ns1:strength ;
@@ -44,12 +20,12 @@ ns1:demoResource7 ns1:endTime 140.711 ;
ns1:time 0.00 ;
ns1:value 0 .
- ns1:time 0.02 ;
+ ns1:time 12.08 ;
ns1:value 1 .
- ns1:time 0.10 ;
+ ns1:time 15.10 ;
ns1:value 1 .
- ns1:time 0.65 ;
+ ns1:time 23.65 ;
ns1:value 0 .