Changeset - d8929e28b8bc
[Not reviewed]
default
0 3 0
drewp@bigasterisk.com - 9 years ago 2016-06-12 02:36:29
drewp@bigasterisk.com
TL: bring back debug line. optimize refreshes when only time cursor changed
Ignore-this: f0a90866c1e909c4f8365873f63c8c24
3 files changed with 18 insertions and 3 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/index.html
Show inline comments
 
@@ -7,7 +7,7 @@
 
    <link rel="import" href="timeline-elements.html"
 
  </head>
 
  <body>
 
    <light9-timeline-editor style="width: 100%; height: 600px">
 
    <light9-timeline-editor style="width: 100%; height: 400px">
 
    </light9-timeline-editor>
 
  </body>
 
</html>
light9/web/timeline/timeline-elements.html
Show inline comments
 
@@ -32,6 +32,11 @@
 
         position: absolute;
 
         left: 0; top: 0; right: 0; bottom: 0;
 
     }
 
     #debug {
 
      background: white;
 
      font-family: monospace;
 
      font-size: 125%;
 
     }
 
    </style>
 
    <div>
 
      <rdfdb-synced-graph graph="{{graph}}"></rdfdb-synced-graph>
 
@@ -43,7 +48,7 @@
 
      timeline editor: song <edit-choice graph="{{graph}}" uri="{{song}}"></edit-choice>
 
      <label><input type="checkbox" checked="{{followPlayerSong::change}}" > follow player song choice</label>
 
    </div>
 
    <div>[[debug]]</div>
 
    <div id="debug">[[debug]]</div>
 
    <iron-ajax id="vidrefTime" url="/vidref/time" method="PUT" content-type="application/json"></iron-ajax>
 
    <light9-timeline-audio id="audio"
 
                           graph="{{graph}}"
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -34,6 +34,7 @@ Polymer
 
    @song = @playerSong if @followPlayerSong
 

	
 
  ready: ->
 
    @debug_zoomOrLayoutChangedCount = 0
 
    @viewState =
 
      zoomSpec:
 
        duration: ko.observable(100)
 
@@ -46,6 +47,11 @@ Polymer
 
    @fullZoomX = d3.scaleLinear()
 
    @zoomInX = d3.scaleLinear()
 
    @setAdjuster = @$.adjusters.setAdjuster.bind(@$.adjusters)
 

	
 
    setInterval(@updateDebugSummary.bind(@), 100)
 

	
 
  updateDebugSummary: ->
 
    @debug = "#{@debug_zoomOrLayoutChangedCount} layout change, "
 
    
 
  attached: ->
 
    @dia = @$.dia
 
@@ -59,6 +65,9 @@ Polymer
 
    @makeZoomAdjs()
 

	
 
  zoomOrLayoutChanged: ->
 
    # not for cursor updates
 

	
 
    @debug_zoomOrLayoutChangedCount++
 
    @fullZoomX.domain([0, @viewState.zoomSpec.duration()])
 
    @fullZoomX.range([0, @width()])
 

	
 
@@ -72,7 +81,8 @@ Polymer
 
    @dia.setTimeAxis(@width(), @$.zoomed.$.audio.offsetTop, @zoomInX)
 
    @$.adjusters.updateAllCoords()
 

	
 
    @songTimeChanged()
 
    # cursor needs update when layout changes, but I don't want zoom/layout to depend on the playback time
 
    setTimeout(@songTimeChanged.bind(@), 1)
 

	
 
  songTimeChanged: ->
 
    @dia.setCursor(@$.audio.offsetTop, @$.audio.offsetHeight,
0 comments (0 inline, 0 general)