Changeset - cc4ca2935921
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 8 years ago 2017-06-09 04:50:11
drewp@bigasterisk.com
closer to edits operating across selected notes
Ignore-this: da21542b378158f586a49e48c0aa9d1c
2 files changed with 16 insertions and 7 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/timeline-elements.html
Show inline comments
 
@@ -55,20 +55,21 @@
 
    <light9-timeline-audio id="audio"
 
                           graph="{{graph}}"
 
                           show="{{show}}"
 
                           song="{{song}}"></light9-timeline-audio>
 
    <light9-timeline-time-zoomed id="zoomed"
 
                                 graph="{{graph}}"
 
                                 selection="{{selection}}"
 
                                 dia="{{dia}}"
 
                                 set-adjuster="{{setAdjuster}}"
 
                                 song="{{song}}"
 
                                 show="{{show}}"
 
                                 zoom="{{viewState.zoomSpec}}"
 
                                 zoom-in-x="{{zoomInX}}">
 
    </light9-timeline-time-zoomed>
 
    <light9-timeline-diagram-layer id="dia"></light9-timeline-diagram-layer>
 
    <light9-timeline-diagram-layer id="dia" selection="{{selection}}"></light9-timeline-diagram-layer>
 
    <light9-adjusters-canvas id="adjustersCanvas" set-adjuster="{{setAdjuster}}">
 
    </light9-adjusters-canvas>
 
    <light9-cursor-canvas id="cursorCanvas"></light9-cursor-canvas>
 
  </template>
 
 
 
</dom-module>
 
@@ -105,12 +106,13 @@
 
                             show="{{show}}"
 
                             zoom="{{zoomFlattened}}">
 
      </light9-timeline-audio>
 
      <div id="rows">
 
        <template is="dom-repeat" items="{{rows}}">
 
          <light9-timeline-graph-row graph="{{graph}}"
 
                                     selection="{{selection}}"
 
                                     dia="{{dia}}"
 
                                     set-adjuster="{{setAdjuster}}"
 
                                     song="{{song}}"
 
                                     zoom-in-x="{{zoomInX}}"
 
                                     row-index="{{item}}"
 
          >
 
@@ -235,12 +237,13 @@
 
         background: green;
 
         /* outline: 2px solid red; */
 
     }
 
    </style>
 
    <light9-timeline-note-inline-attrs rect="{{inlineRect}}"
 
                                       graph="{{graph}}"
 
                                       selection="{{selection}}"
 
                                       song="{{song}}"
 
                                       uri="{{uri}}"
 
    >
 
    </light9-timeline-note-inline-attrs>
 
  </template>
 
</dom-module>
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -36,12 +36,13 @@ Polymer
 
    show: {value: 'http://light9.bigasterisk.com/show/dance2017'}
 
    songTime: {type: Number, notify: true, observer: '_onSongTime'}
 
    songDuration: {type: Number, notify: true, observer: '_onSongDuration'}
 
    songPlaying: {type: Boolean, notify: true}
 
    fullZoomX: {type: Object, notify: true}
 
    zoomInX: {type: Object, notify: true}
 
    selection: {type: Object, notify: true}
 
  width: ko.observable(1)
 
  listeners:
 
    'iron-resize': '_onIronResize'
 
  observers: [
 
    'setSong(playerSong, followPlayerSong)'
 
    ]
 
@@ -54,12 +55,13 @@ Polymer
 
    @viewState.zoomSpec.duration(d)
 
  setSong: (s) ->
 
    @song = @playerSong if @followPlayerSong
 

	
 
  ready: ->
 
    ko.options.deferUpdates = true;
 
    @selection = {hover: ko.observable(null), selected: ko.observable([])}
 

	
 
    window.debug_zoomOrLayoutChangedCount = 0
 
    window.debug_adjUpdateDisplay = 0
 
    
 
    @viewState =
 
      zoomSpec:
 
@@ -81,12 +83,13 @@ Polymer
 
    #  disconnect the graph, make many notes, drag a point over many steps, measure lag somewhere
 

	
 
  updateDebugSummary: ->
 
    elemCount = (tag) -> document.getElementsByTagName(tag).length
 
    @debug = "#{window.debug_zoomOrLayoutChangedCount} layout change,
 
     #{elemCount('light9-timeline-note')} notes,
 
     #{@selection.selected().length} selected
 
     #{elemCount('light9-timeline-graph-row')} rows,
 
     #{window.debug_adjsCount} adjuster items registered,
 
     #{window.debug_adjUpdateDisplay} adjuster updateDisplay calls,
 
    "
 
    
 
  attached: ->
 
@@ -259,12 +262,13 @@ Polymer
 

	
 
Polymer
 
  is: 'light9-timeline-time-zoomed'
 
  behaviors: [ Polymer.IronResizableBehavior ]
 
  properties:
 
    graph: { type: Object, notify: true }
 
    selection: { type: Object, notify: true }
 
    dia: { type: Object, notify: true }
 
    song: { type: String, notify: true }
 
    zoomInX: { type: Object, notify: true }
 
    rows: { value: [0...ROW_COUNT] }
 
    zoom: { type: Object, notify: true, observer: 'onZoom' }
 
    zoomFlattened: { type: Object, notify: true }
 
@@ -371,12 +375,13 @@ Polymer
 
    graph: { type: Object, notify: true }
 
    dia: { type: Object, notify: true }
 
    song:  { type: String, notify: true }
 
    zoomInX: { type: Object, notify: true }
 
    noteUris: { type: Array, notify: true }
 
    rowIndex: { type: Object, notify: true }
 
    selection: { type: Object, notify: true }
 
  observers: [
 
    'onGraph(graph, dia, setAdjuster, song, zoomInX)'
 
    'update(song, rowIndex)'
 
    'onZoom(zoomInX)'
 
    ]
 
  onGraph: ->
 
@@ -391,12 +396,13 @@ Polymer
 
        notesForThisRow.push(n)
 
      i++
 

	
 
    updateChildren @, notesForThisRow, (newUri) =>
 
      child = document.createElement('light9-timeline-note')
 
      child.graph = @graph
 
      child.selection = @selection
 
      child.dia = @dia
 
      child.uri = newUri
 
      child.setAdjuster = @setAdjuster
 
      child.song = @song # could change, but all the notes will be rebuilt
 
      child.zoomInX = @zoomInX # missing binding; see onZoom
 
      return child      
 
@@ -420,12 +426,13 @@ getCurvePoints = (graph, curve, xOffset)
 
Polymer
 
  is: 'light9-timeline-note'
 
  behaviors: [ Polymer.IronResizableBehavior ]
 
  listeners: 'iron-resize': 'update'
 
  properties:
 
    graph: { type: Object, notify: true }
 
    selection: { type: Object, notify: true }
 
    dia: { type: Object, notify: true }
 
    uri: { type: String, notify: true }
 
    zoomInX: { type: Object, notify: true }
 
    setAdjuster: {type: Function, notify: true }
 
    inlineRect: { type: Object, notify: true }
 
  observers: [
 
@@ -576,25 +583,26 @@ Polymer
 
    uri: { type: String, notify: true }  # the Note
 
    rect: { type: Object, notify: true }
 
    effect: { type: String, notify: true }
 
    effectLabel: { type: String, notify: true }
 
    colorScale: { type: String, notify: true }
 
    noteLabel: { type: String, notify: true }
 
    selection: { type: Object, notify: true }
 
  observers: [
 
    'addHandler(graph, uri)'
 
    'onColorScale(graph, uri, colorScale)'
 
    ]
 
  displayed: ->
 
    @querySelector('light9-color-picker').displayed()
 
  onColorScale: ->
 
    U = (x) => @graph.Uri(x)
 
    if @colorScale == @colorScaleFromGraph
 
      return
 
      
 
    quad = (s, p, o) => {subject: s, predicate: p, object: o, graph: @song}
 

	
 
    log('ch', ko.toJS(@selection))
 
    settingValue = @graph.Literal(@colorScale)
 
    if @existingColorScaleSetting
 
      @graph.patchObject(@existingColorScaleSetting, U(':value'), settingValue, @song)
 
    else
 
      setting = @graph.nextNumberedResource(@uri + 'set')
 
      patch = {delQuads: [], addQuads: [
 
@@ -888,16 +896,17 @@ Polymer
 
    # connector
 

	
 
  
 
Polymer
 
  # note boxes. Page selection.
 
  is: 'light9-timeline-diagram-layer'
 
  properties: {}
 
  properties: {
 
    selection: {type: Object, notify: true}
 
  }
 
  ready: ->
 
    @elemById = {}
 
    @selection = {hover: ko.observable(null), selected: ko.observable([])}
 

	
 
  attached: ->
 
    @querySelector('svg').add
 

	
 
  setTimeAxis: (width, yTop, scale) ->
 
    pxPerTick = 50
 
@@ -951,26 +960,23 @@ Polymer
 
      sat = 40 + (hash % 20) # don't conceal colorscale too much
 

	
 
    attrs = {style: "fill:hsla(#{hue}, #{sat}%, 58%, 0.313);"}
 
    elem = @getOrCreateElem areaId, 'notes', 'path', attrs, (elem) =>
 
      elem.addEventListener 'mouseenter', =>
 
        @selection.hover(uri)
 
        log('enter', uri)
 
      elem.addEventListener 'mousedown', (ev) =>
 
        log('click', uri)
 
        sel = @selection.selected()
 
        if ev.getModifierState('Control')
 
          if uri in sel
 
            sel = _.without(sel, uri)
 
          else
 
            sel.push(uri)
 
        else
 
          sel = [uri]
 
        @selection.selected(sel)
 
      elem.addEventListener 'mouseleave', =>
 
        log('leave', uri)
 
        @selection.hover(null)
 
    elem.setAttribute('d', svgPathFromPoints(curvePts))
 
    @updateNotePathClasses(uri, elem)
 

	
 
  updateNotePathClasses: (uri, elem) ->
 
    ko.computed =>
0 comments (0 inline, 0 general)