changeset 1745:b0d6ace1db5a

inlineAttrs shows effect choice Ignore-this: f3798429d4692207ffe6cc3a7f9ef56b
author Drew Perttula <drewp@bigasterisk.com>
date Sat, 19 May 2018 23:40:35 +0000
parents ee3273dc1589
children 84adc69fdf8a
files light9/web/timeline/inline-attrs.coffee light9/web/timeline/inline-attrs.html light9/web/timeline/timeline-elements.html
diffstat 3 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/timeline/inline-attrs.coffee	Sat May 19 23:35:42 2018 +0000
+++ b/light9/web/timeline/inline-attrs.coffee	Sat May 19 23:40:35 2018 +0000
@@ -8,6 +8,7 @@
     config: { type: Object } # just for setup
     uri: { type: Object, notify: true }  # the Note
     effect: { type: Object, notify: true }
+    effectStr: { type: String, notify: true }
     colorScale: { type: String, notify: true }
     noteLabel: { type: String, notify: true }
     selection: { type: Object, notify: true }
@@ -15,14 +16,21 @@
     'addHandler(graph, uri)'
     'onColorScale(graph, uri, colorScale)'
     '_onConfig(config)'
+    '_effectToStr(effect)'
+    '_effectToUri(effectStr, graph)'
     ]
+  _effectToStr: (effect) ->
+    @effectStr = @effect?.value
+    log('now str is', @effectStr)
+  _effectToUri: (effectStr, graph) ->
+    if @effectStr
+      @effect = @graph.Uri(@effectStr)
+    else
+      @effect = null
   _onConfig: ->
     @uri = @config.uri
     for side in ['top', 'left', 'width', 'height']
       @.style[side] = @config[side] + 'px'
-
-  displayed: ->
-    @querySelector('light9-color-picker').displayed()
     
   onColorScale: ->
     return
@@ -36,7 +44,7 @@
     if not song?
       log("can't edit inline attr yet, no song")
       return
-    quad = (s, p, o) => {subject: s, predicate: p, object: o, graph: song}
+    quad = (s, p, o) => {subject: s, predicate: p, object: o, graph: U(song)}
 
     existingColorScaleSetting = null
     for setting in @graph.objects(note, U(':setting'))
@@ -45,9 +53,9 @@
         existingColorScaleSetting = setting
         
     if existingColorScaleSetting
-      @graph.patchObject(existingColorScaleSetting, U(':value'), value, song)
+      @graph.patchObject(existingColorScaleSetting, U(':value'), value, U(song))
     else
-      setting = @graph.nextNumberedResource(note + 'set')
+      setting = @graph.nextNumberedResource(note.value + 'set')
       patch = {delQuads: [], addQuads: [
         quad(note, U(':setting'), setting)
         quad(setting, U(':effectAttr'), attr)
@@ -56,15 +64,16 @@
       @graph.applyAndSendPatch(patch)
     
   addHandler: ->
-    return
-    @graph.runHandler(@update.bind(@), "update inline attrs #{@uri}")
+    return unless @uri
+    @graph.runHandler(@update.bind(@), "update inline attrs #{@uri.value}")
     
   update: ->
-    #console.time('attrs update')
+    return unless @uri?
+    console.time('attrs update')
     U = (x) => @graph.Uri(x)
     @effect = @graph.uriValue(@uri, U(':effectClass'))
-    @noteLabel = @uri.replace(/.*\//, '')
-
+    @noteLabel = @uri.value.replace(/.*\//, '')
+    return
     existingColorScaleSetting = null
     for setting in @graph.objects(@uri, U(':setting'))
       ea = @graph.uriValue(setting, U(':effectAttr'))
@@ -76,7 +85,7 @@
     if existingColorScaleSetting == null
       @colorScaleFromGraph = '#ffffff'
       @colorScale = '#ffffff'
-    #console.timeEnd('attrs update')
+    console.timeEnd('attrs update')
 
 
   onDel: ->
--- a/light9/web/timeline/inline-attrs.html	Sat May 19 23:35:42 2018 +0000
+++ b/light9/web/timeline/inline-attrs.html	Sat May 19 23:40:35 2018 +0000
@@ -22,7 +22,7 @@
 
       <div>note [[noteLabel]] <button on-click="onDel">del</button></div>
       <table>
-        <tr><th>effect:</th><td><edit-choice graph="{{graph}}" uri="{{effect}}"></edit-choice></td></tr>
+        <tr><th>effect:</th><td><edit-choice graph="{{graph}}" uri="{{effectStr}}"></edit-choice></td></tr>
         <tr><th>colorScale:</th><td>
           <light9-color-picker color="{{colorScale}}"></light9-color-picker>
         </td></tr>
--- a/light9/web/timeline/timeline-elements.html	Sat May 19 23:35:42 2018 +0000
+++ b/light9/web/timeline/timeline-elements.html	Sat May 19 23:40:35 2018 +0000
@@ -122,8 +122,8 @@
     <template is="dom-repeat" items="{{inlineAttrConfigs}}">
       <light9-timeline-note-inline-attrs graph="{{graph}}"
                                          song="{{song}}"
-                                         config="{{item}}"
-      ></light9-timeline-note-inline-attrs>
+                                         config="{{item}}">
+      </light9-timeline-note-inline-attrs>
     </template>
   </template>
 </dom-module>