Changeset - 56e435ac7a41
[Not reviewed]
default
0 2 0
Drew Perttula - 7 years ago 2018-06-08 09:54:08
drewp@bigasterisk.com
start the ui work for multiselect on /live
Ignore-this: 9cfd22eac4d49b093643027e387f4f5e
2 files changed with 32 insertions and 6 deletions:
0 comments (0 inline, 0 general)
light9/web/live/elements.html
Show inline comments
 
@@ -179,14 +179,20 @@
 
         color: #9ab8fd;
 
         text-decoration: initial;
 
     }
 
     .device.selected h2 {
 
         outline: 3px solid #ffff0047;
 
     }
 
     .deviceAttr.selected {
 
         background: #cada1829;
 
     }
 
    </style>
 
    <div class="device">
 
      <h2 style$="[[bgStyle]]">
 
    <div class$="device {{devClasses}}">
 
      <h2 style$="[[bgStyle]]" on-click="onClick">
 
        <resource-display id="mainLabel" graph="{{graph}}" uri="{{uri}}"></resource-display>
 
        a <resource-display minor graph="{{graph}}" uri="{{deviceClass}}"></resource-display>
 
      </h2>
 
      <template is="dom-repeat" items="{{deviceAttrs}}" as="dattr">
 
        <div class="deviceAttr">
 
        <div on-click="onAttrClick" class$="deviceAttr {{dattr.attrClasses}}">
 
          <span>attr <resource-display minor graph="{{graph}}" uri="{{dattr.uri}}"></resource-display></span>
 
          <light9-live-control
 
            graph="{{graph}}"
light9/web/live/live.coffee
Show inline comments
 
@@ -99,13 +99,17 @@ coffeeElementSetup(class Light9LiveDevic
 
    graph: { type: Object, notify: true }
 
    uri: { type: String, notify: true }
 
    effect: { type: String }
 
    deviceClass: { type: String, notify: true }
 
    deviceClass: { type: String, notify: true } # the uri str
 
    deviceAttrs: { type: Array, notify: true }
 
    graphToControls: { type: Object }
 
    bgStyle: { type: String, computed: '_bgStyle(deviceClass)' }
 
    devClasses: { type: String, value: '' } # the css kind
 
  @getter_observers: [
 
    'onGraph(graph)'
 
    ]
 
  constructor: ->
 
    super()
 
    @selectedAttrs = new Set() # uri strings
 
  _bgStyle: (deviceClass) ->
 
    hash = 0
 
    deviceClass = deviceClass.value
 
@@ -118,6 +122,16 @@ coffeeElementSetup(class Light9LiveDevic
 
  onGraph: ->
 
    @graph.runHandler(@update.bind(@), "#{@uri.value} update")
 
    
 
  setDeviceSelected: (isSel) ->
 
    @devClasses = if isSel then 'selected' else ''
 

	
 
  setAttrSelected: (devAttr, isSel) ->
 
    if isSel
 
      @selectedAttrs.add(devAttr.value)
 
    else
 
      @selectedAttrs.delete(devAttr.value)
 
    @update()
 
    
 
  update: (patch) ->
 
    U = (x) => @graph.Uri(x)
 
    return if patch? and not SyncedGraph.patchContainsPreds(
 
@@ -134,6 +148,7 @@ coffeeElementSetup(class Light9LiveDevic
 
      uri: devAttr
 
      dataType: dataType
 
      showColorPicker: dataType.equals(U(':color'))
 
      attrClasses: if @selectedAttrs.has(devAttr.value) then 'selected' else ''
 
      }
 
    if dataType.equals(U(':color'))
 
      daRow.useColor = true
 
@@ -154,13 +169,18 @@ coffeeElementSetup(class Light9LiveDevic
 
    for lc in @shadowRoot.querySelectorAll("light9-live-control")
 
      lc.clear()
 
    
 
  onClick: (ev) ->
 
    log('click', @uri)
 
    # select, etc
 

	
 
  onAttrClick: (ev) ->
 
    log('attr click', @uri, ev.model.dattr.uri)
 
    # select
 
)
 

	
 

	
 
class ActiveSettings
 
  # Maintains the settings on this effect
 
  constructor: (@graph) ->
 

	
 
    # The settings we're showing (or would like to but the widget
 
    # isn't registered yet):
 
    # dev+attr : {setting: Uri, onChangeFunc: f, jsValue: str_or_float}
0 comments (0 inline, 0 general)