Changeset - b0d6ace1db5a
[Not reviewed]
default
0 3 0
Drew Perttula - 7 years ago 2018-05-19 23:40:35
drewp@bigasterisk.com
inlineAttrs shows effect choice
Ignore-this: f3798429d4692207ffe6cc3a7f9ef56b
3 files changed with 24 insertions and 15 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/inline-attrs.coffee
Show inline comments
 
@@ -8,6 +8,7 @@ coffeeElementSetup(class InlineAttrs ext
 
    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 @@ coffeeElementSetup(class InlineAttrs ext
 
    '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 @@ coffeeElementSetup(class InlineAttrs ext
 
    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 @@ coffeeElementSetup(class InlineAttrs ext
 
        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 @@ coffeeElementSetup(class InlineAttrs ext
 
      @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 @@ coffeeElementSetup(class InlineAttrs ext
 
    if existingColorScaleSetting == null
 
      @colorScaleFromGraph = '#ffffff'
 
      @colorScale = '#ffffff'
 
    #console.timeEnd('attrs update')
 
    console.timeEnd('attrs update')
 

	
 

	
 
  onDel: ->
light9/web/timeline/inline-attrs.html
Show inline comments
 
@@ -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>
light9/web/timeline/timeline-elements.html
Show inline comments
 
@@ -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>
0 comments (0 inline, 0 general)