changeset 1758:887eb43b389a

properly clear adjs on narrow notes Ignore-this: 175b1c2b7ffdcccadfd49d8f81d9f3ad
author Drew Perttula <drewp@bigasterisk.com>
date Mon, 28 May 2018 00:25:46 +0000
parents 3368aeaded44
children 72380e12d86c
files light9/web/timeline/timeline.coffee light9/web/timeline/viewstate.coffee
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/timeline/timeline.coffee	Mon May 28 00:25:29 2018 +0000
+++ b/light9/web/timeline/timeline.coffee	Mon May 28 00:25:46 2018 +0000
@@ -446,7 +446,7 @@
     @parentElem.updateInlineAttrs(@uri, null)
 
   clearAdjusters: ->
-    for i in @adjusterIds.keys()
+    @adjusterIds.forEach (i) =>
       @setAdjuster(i, null)
     @adjusterIds.clear()
 
@@ -533,7 +533,8 @@
     @_updateDisplay()
 
   _updateAdjusters: (screenPts, worldPts, curveWidthCalc, yForV, ctx) ->
-    if screenPts[screenPts.length - 1].x - screenPts[0].x < 100
+    # todo: allow offset even on more narrow notes
+    if screenPts[screenPts.length - 1].x - screenPts[0].x < 100 or screenPts[0].x > @parentElem.offsetWidth or screenPts[screenPts.length - 1].x < 0
       @clearAdjusters()
     else
       @_makeOffsetAdjuster(yForV, curveWidthCalc, ctx)
--- a/light9/web/timeline/viewstate.coffee	Mon May 28 00:25:29 2018 +0000
+++ b/light9/web/timeline/viewstate.coffee	Mon May 28 00:25:46 2018 +0000
@@ -38,11 +38,12 @@
     if @zoomSpec.duration() and @zoomSpec.t2() > @zoomSpec.duration()
       @zoomSpec.t2(@zoomSpec.duration())
 
+    rightPad = 2 # don't let time adjuster fall off right edge
     @fullZoomX.domain([0, @zoomSpec.duration()])
-    @fullZoomX.range([0, @width()])
+    @fullZoomX.range([0, @width() - rightPad])
 
     @zoomInX.domain([@zoomSpec.t1(), @zoomSpec.t2()])
-    @zoomInX.range([0, @width()])
+    @zoomInX.range([0, @width() - rightPad])
     
   latestMouseTime: ->
     @zoomInX.invert(@mouse.pos().e(1))