Changeset - a49ad994b467
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 7 years ago 2018-06-08 11:08:34
drewp@bigasterisk.com
dead code rm, more debugging of settings corruption. i think it's from partially-loaded graphs
Ignore-this: 8d8f5e7367046b8e371b129b5bd1261d
1 file changed with 8 insertions and 9 deletions:
0 comments (0 inline, 0 general)
light9/web/live/live.coffee
Show inline comments
 
@@ -231,8 +231,11 @@ class ActiveSettings
 
    return null
 

	
 
  deleteSetting: (setting) ->
 
    log('deleteSetting ' + setting.value)
 
    key = @keyForSetting.get(setting.value)
 
    row = @settings.get(key)
 
    if row? and not row.setting.equals(setting)
 
      throw new Error('corrupt row for ' + setting.value)
 
    row.onChangeFunc(null) if row?.onChangeFunc?
 
    @settings.delete(key)
 
    @keyForSetting.delete(setting)
 
@@ -323,9 +326,6 @@ class GraphToControls
 
  clearSettings: ->
 
    @activeSettings.clear()
 

	
 
  effectSettingLookup: (device, attr) ->
 
    @activeSettings.effectSettingLookup(device, attr)
 

	
 
  register: (device, deviceAttr, graphValueChanged) ->
 
    @activeSettings.registerWidget(device, deviceAttr, graphValueChanged)
 

	
 
@@ -343,7 +343,7 @@ class GraphToControls
 
    # value is float or #color or (Uri or null)
 
    if (value == undefined or (typeof value == "number" and isNaN(value)) or (typeof value == "object" and value != null and not value.id))
 
      throw new Error("controlChanged sent bad value " + value)
 
    effectSetting = @effectSettingLookup(device, deviceAttr)
 
    effectSetting = @activeSettings.effectSettingLookup(device, deviceAttr)
 
    if @shouldBeStored(deviceAttr, value)
 
      if not effectSetting?
 
        @_addEffectSetting(device, deviceAttr, value)
 
@@ -416,15 +416,14 @@ coffeeElementSetup(class Light9LiveContr
 
    @graphToControls = new GraphToControls(@graph)
 
    @graph.runHandler(@update.bind(@), 'Light9LiveControls update')
 

	
 
    # need graph to be loaded, so we don't make double settings? not sure.
 
    setTimeout(@setFromUrl.bind(@), 1)
 

	
 
  setFromUrl: ->
 
    effect = new URL(window.location.href).searchParams.get('effect')
 
    if effect?
 
      @effectChoice = effect
 

	
 
  effectSettingLookup: (device, attr) ->
 
    if @graphToControls == null
 
      throw new Error('not ready')
 
    return @graphToControls.effectSettingLookup(device, attr)
 

	
 
  newEffect: ->
 
    @effectChoice = @graphToControls.newEffect().value
 
      
0 comments (0 inline, 0 general)