changeset 1755:e82a8a48120c

update note drawings correctly. rerender less. Ignore-this: f673b26f919d98b5ee18c1dd94a877f2
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 27 May 2018 01:16:49 +0000
parents 0c89cd7cda43
children a73468c02bce
files light9/web/timeline/adjusters.coffee light9/web/timeline/timeline.coffee
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/timeline/adjusters.coffee	Sun May 27 00:13:00 2018 +0000
+++ b/light9/web/timeline/adjusters.coffee	Sun May 27 01:16:49 2018 +0000
@@ -1,7 +1,6 @@
 log = console.log
 Drawing = window.Drawing
 
-
 coffeeElementSetup(class AdjustersCanvas extends Polymer.mixinBehaviors([Polymer.IronResizableBehavior], Polymer.Element)
   @is: 'light9-adjusters-canvas'
   @getter_properties:
@@ -11,7 +10,7 @@
   ]
   constructor: ->
     super()
-    @redraw = _.throttle(@_throttledRedraw.bind(@), 30, {leading: false})
+    @redraw = _.throttle(@_throttledRedraw.bind(@), 60, {leading: false})
     @adjs = {}
     
   ready: ->
--- a/light9/web/timeline/timeline.coffee	Sun May 27 00:13:00 2018 +0000
+++ b/light9/web/timeline/timeline.coffee	Sun May 27 01:16:49 2018 +0000
@@ -306,6 +306,7 @@
       antialias: true,
       forceCanvas: true,
     })
+    @dirty = _.debounce((() => @renderer.render(@stage)), 10)
 
   ready: ->
     super.ready()
@@ -328,11 +329,14 @@
 
     @renderer.resize(@clientWidth, @clientHeight + @viewState.rowsY())
 
-    @renderer.render(@stage)
+    @dirty()
 
   _onGraph: (graph, setAdjuster, song, viewState, project)->
     return unless @song # polymer will call again
     @graph.runHandler(@gatherNotes.bind(@), 'zoom notes')
+
+  noteDirty: ->
+    @dirty()
     
   onZoom: ->
     updateZoomFlattened = ->
@@ -501,6 +505,7 @@
     curveWidthCalc = () => @project.curveWidth(worldPts)
     @_updateAdjusters(screenPts, worldPts, curveWidthCalc, yForV, @song)
     @_updateInlineAttrs(screenPts)
+    @parentElem.noteDirty()
 
   onUri: ->
     @graph.runHandler(@update.bind(@), "note updates #{@uri}")