# HG changeset patch # User Drew Perttula # Date 2018-05-19 23:40:35 # Node ID b0d6ace1db5a9dfb0b0f18c4173ed3aa59ffbc9a # Parent ee3273dc1589b4d56a6468d0e41f3a526196903f inlineAttrs shows effect choice Ignore-this: f3798429d4692207ffe6cc3a7f9ef56b diff --git a/light9/web/timeline/inline-attrs.coffee b/light9/web/timeline/inline-attrs.coffee --- a/light9/web/timeline/inline-attrs.coffee +++ b/light9/web/timeline/inline-attrs.coffee @@ -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: -> diff --git a/light9/web/timeline/inline-attrs.html b/light9/web/timeline/inline-attrs.html --- a/light9/web/timeline/inline-attrs.html +++ b/light9/web/timeline/inline-attrs.html @@ -22,7 +22,7 @@
note [[noteLabel]]
- + diff --git a/light9/web/timeline/timeline-elements.html b/light9/web/timeline/timeline-elements.html --- a/light9/web/timeline/timeline-elements.html +++ b/light9/web/timeline/timeline-elements.html @@ -122,8 +122,8 @@
effect:
effect:
colorScale: