Changeset - 11b74e7d6b88
[Not reviewed]
default
0 1 0
Drew Perttula - 8 years ago 2017-06-10 05:59:22
drewp@bigasterisk.com
draw adjusters for all curve pts, not just 4
Ignore-this: 28b553a4935b4900496499d74489d8ee
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -526,49 +526,51 @@ Polymer
 
      height: h,
 
      display: if rightX - leftX > w then 'block' else 'none'
 
      }
 
    if wasHidden and @inlineRect.display != 'none'
 
      @async =>
 
        @querySelector('light9-timeline-note-inline-attrs')?.displayed()
 
    
 
  _getCurvePoints: (curve, xOffset) ->
 
    worldPts = []
 
    uris = @graph.objects(curve, @graph.Uri(':point'))
 
    for pt in uris
 
      v = $V([xOffset + @graph.floatValue(pt, @graph.Uri(':time')),
 
              @graph.floatValue(pt, @graph.Uri(':value'))])
 
      v.uri = pt
 
      worldPts.push(v)
 
    worldPts.sort((a,b) -> a.e(1) > b.e(1))
 
    return [uris, worldPts]
 

	
 
  _curveWidth: (worldPts) ->
 
    tMin = @graph.floatValue(worldPts[0].uri, @graph.Uri(':time'))
 
    tMax = @graph.floatValue(worldPts[3].uri, @graph.Uri(':time'))
 
    tMax - tMin
 
    
 
  _makeCurvePointAdjusters: (yForV, worldPts) ->
 
    for pointNum in [0, 1, 2, 3]
 
    
 
    for pointNum in [0...worldPts.length]
 
      log('wor', worldPts, pointNum)
 
      @_makePointAdjuster(yForV, worldPts, pointNum)
 

	
 
  _makePointAdjuster: (yForV, worldPts, pointNum) ->
 
    U = (x) => @graph.Uri(x)
 

	
 
    adjId = @uri + '/p' + pointNum
 
    @adjusterIds[adjId] = true
 
    @setAdjuster adjId, =>
 
      adj = new AdjustableFloatObject({
 
        graph: @graph
 
        subj: worldPts[pointNum].uri
 
        pred: U(':time')
 
        ctx: U(@song)
 
        getTargetPosForValue: (value) =>
 
          $V([@zoomInX(value), yForV(worldPts[pointNum].e(2))])
 
        getValueForPos: (pos) =>
 
          origin = @graph.floatValue(@uri, U(':originTime'))
 
          (@zoomInX.invert(pos.e(1)) - origin)
 
        getSuggestedTargetOffset: () => @_suggestedOffset(worldPts[pointNum]),
 
      })
 
      adj._getValue = (=>
 
        # note: don't use originTime from the closure- we need the
 
        # graph dependency
 
        adj._currentValue + @graph.floatValue(@uri, U(':originTime'))
0 comments (0 inline, 0 general)