Changeset - e6eb97a87117
[Not reviewed]
default
0 1 0
Drew Perttula - 7 years ago 2018-06-05 06:06:51
drewp@bigasterisk.com
fix 'clear all' in live
Ignore-this: cae71ca982f3f136a57f6399480ffcb2
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light9/web/live/live.coffee
Show inline comments
 
@@ -73,24 +73,28 @@ coffeeElementSetup(class Light9LiveDevic
 
        daRow.useChoice = true
 
        choiceUris = @graph.sortedUris(@graph.objects(da, U(':choice')))
 
        daRow.choices = ({uri: x, label: @graph.labelOrTail(x)} for x in choiceUris)
 
        daRow.choiceSize = Math.min(choiceUris.length + 1, 10)
 
      else
 
        daRow.useSlider = true
 
        daRow.max = 1
 
        if dataType.equals(U(':angle'))
 
          # varies
 
          daRow.max = 1
 

	
 
      @push('deviceAttrs', daRow)
 
  clear: ->
 
    for lc in @shadowRoot.querySelectorAll("light9-live-control")
 
      lc.clear()
 
    
 
)
 
    
 
coffeeElementSetup(class Light9LiveControls extends Polymer.Element
 
  @is: "light9-live-controls"
 
  @getter_properties:
 
    graph: { type: Object, notify: true }
 
    client: { type: Object, notify: true }
 
    devices: { type: Array, notify: true }
 
    currentSettings: { type: Object, notify: true } # dev+attr: [dev, attr, value]
 
    effectPreview: { type: String, notify: true }
 
    newEffectName: { type: String, notify: true }
 
    effect: { type: String, notify: true } # the one being edited, if any
 
@@ -171,30 +175,32 @@ coffeeElementSetup(class Light9LiveContr
 
          @graph.LiteralRoundedFloat(row[2])
 
        else
 
          @graph.Literal(row[2])
 
      addQuads.push(quad(setting, @valuePred(row[1]), value))
 
      
 
    patch = {addQuads: addQuads, delQuads: []}
 
    log('save', patch)
 
    @graph.applyAndSendPatch(patch)
 
    @newEffectName = ''
 

	
 
  onGraph: ->
 
    @graph.runHandler(@update.bind(@), 'controls')
 
    
 
  resendAll: ->
 
    for llc in @getElementsByTagName("light9-live-control")
 
      llc.resend()
 
      
 
  clearAll: ->
 
    for llc in @getElementsByTagName("light9-live-control")
 
      llc.clear()
 
    for dc in @shadowRoot.querySelectorAll("light9-live-device-control")
 
      dc.clear()
 
    
 
  update: ->
 
    U = (x) => @graph.Uri(x)
 

	
 
    @set('devices', [])
 
    for dc in @graph.sortedUris(@graph.subjects(U('rdf:type'), U(':DeviceClass')))
 
      for dev in @graph.sortedUris(@graph.subjects(U('rdf:type'), dc))
 
        @push('devices', {uri: dev})
 

	
 
    return
 

	
 
    # Tried css columns- big slowdown from relayout as I'm scrolling.
0 comments (0 inline, 0 general)