changeset 1783:717a971132eb

float vs str values on live Ignore-this: 9eb228a2a3b2e9cdb4fe821251703268
author Drew Perttula <drewp@bigasterisk.com>
date Tue, 05 Jun 2018 06:55:45 +0000
parents e6eb97a87117
children 1aac97248a1b
files light9/web/graph.coffee light9/web/light9-color-picker.html light9/web/live/live.coffee
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/graph.coffee	Tue Jun 05 06:06:51 2018 +0000
+++ b/light9/web/graph.coffee	Tue Jun 05 06:55:45 2018 +0000
@@ -285,7 +285,10 @@
     return hit if hit != undefined
     #log('float miss', s, p)
 
-    ret = parseFloat(@_singleValue(s, p).value)
+    v = @_singleValue(s, p).value
+    ret = parseFloat(v)
+    if isNaN(ret)
+      throw new Error("#{s.value} #{p.value} -> #{v} not a float")
     @cachedFloatValues.set(key, ret)
     return ret
     
--- a/light9/web/light9-color-picker.html	Tue Jun 05 06:06:51 2018 +0000
+++ b/light9/web/light9-color-picker.html	Tue Jun 05 06:55:45 2018 +0000
@@ -307,7 +307,9 @@
      }
      hideLarge() {
        this.$.large.style.display = 'none';
-       this.readColor(this.color);
+       if (this.color !== undefined) {
+         this.readColor(this.color);
+       }
        this.closeTime = Date.now();
      }
      onEnterSmall(ev) {
--- a/light9/web/live/live.coffee	Tue Jun 05 06:06:51 2018 +0000
+++ b/light9/web/live/live.coffee	Tue Jun 05 06:55:45 2018 +0000
@@ -132,7 +132,7 @@
   valuePred: (attr) ->
     U = (x) => @graph.Uri(x)
     scaledAttributeTypes = [U(':color'), U(':brightness'), U(':uv')]
-    if attr in scaledAttributeTypes then U(':scaledValue') else U(':value')
+    if [attr.equals(x) for x in scaledAttributeTypes].length then U(':scaledValue') else U(':value')
 
   onEffect: ->
     U = (x) => @graph.Uri(x)
@@ -149,6 +149,7 @@
         value = @graph.stringValue(s, pred)
       log('got', devAttr, value)
       window.gather([[dev, devAttr, value]])
+      # there's nothing here to set the widgets to these values.
             
   saveNewEffect: ->
     uriName = @newEffectName.replace(/[^a-zA-Z0-9_]/g, '')