Changeset - 15cdf021c07f
[Not reviewed]
default
0 2 0
Drew Perttula - 7 years ago 2018-05-15 06:33:39
drewp@bigasterisk.com
oops, time cursor was tracking mouse not music time
Ignore-this: 4a659c258fb87156a44a53e11b50baed
2 files changed with 6 insertions and 7 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/cursor_canvas.coffee
Show inline comments
 
coffeeElementSetup(class CursorCanvas extends Polymer.mixinBehaviors([Polymer.IronResizableBehavior], Polymer.Element)
 
  @is: 'light9-cursor-canvas'
 
  @getter_properties:
 
    viewState: { type: Object, notify: true, observer: "onViewState" }
 
  ready: ->
 
    super.ready()
 
    @mouseX = 0
 
    @mouseY = 0
 
    @cursorPath = null
 
    @ctx = @$.canvas.getContext('2d')
 
    @onResize()
 
    @addEventListener('iron-resize', @onResize.bind(@))
 

	
 
  onViewState: ->
 
@@ -19,14 +17,14 @@ coffeeElementSetup(class CursorCanvas ex
 
    @$.canvas.height = @offsetHeight
 
    @redrawCursor()
 

	
 
  redrawCursor: ->
 
    vs = @viewState
 
    dependOn = [vs.zoomSpec.t1(), vs.zoomSpec.t2()]
 
    xZoomedOut = vs.fullZoomX(vs.latestMouseTime())
 
    xZoomedIn = vs.mouse.pos().e(1)
 
    xZoomedOut = vs.fullZoomX(vs.cursor.t())
 
    xZoomedIn = vs.zoomInX(vs.cursor.t())
 

	
 
    @cursorPath = {
 
      top0: $V([xZoomedOut, vs.audioY()])
 
      top1: $V([xZoomedOut, vs.audioY() + vs.audioH()])
 
      mid0: $V([xZoomedIn + 2, vs.zoomedTimeY() + vs.zoomedTimeH()])
 
      mid1: $V([xZoomedIn - 2, vs.zoomedTimeY() + vs.zoomedTimeH()])
 
@@ -41,14 +39,15 @@ coffeeElementSetup(class CursorCanvas ex
 
    return unless @ctx
 
    @ctx.clearRect(0, 0, @$.canvas.width, @$.canvas.height)
 

	
 
    @ctx.strokeStyle = '#fff'
 
    @ctx.lineWidth = 0.5
 
    @ctx.beginPath()
 
    Drawing.line(@ctx, $V([0, @mouseY]), $V([@$.canvas.width, @mouseY]))
 
    Drawing.line(@ctx, $V([@mouseX, 0]), $V([@mouseX, @$.canvas.height]))
 
    mouse = @viewState.mouse.pos()
 
    Drawing.line(@ctx, $V([0, mouse.e(2)]), $V([@$.canvas.width, mouse.e(2)]))
 
    Drawing.line(@ctx, $V([mouse.e(1), 0]), $V([mouse.e(1), @$.canvas.height]))
 
    @ctx.stroke()
 

	
 
    if @cursorPath
 
      @ctx.strokeStyle = '#ff0303'
 
      @ctx.lineWidth = 1.5
 
      @ctx.beginPath()
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -230,13 +230,13 @@ coffeeElementSetup(class TimelineEditor 
 
    @addEventListener('mousedown', ac.onDown.bind(ac))
 
    @addEventListener('mousemove', ac.onMove.bind(ac))
 
    @addEventListener('mouseup', ac.onUp.bind(ac))
 

	
 
  bindKeys: ->
 
    shortcut.add "Ctrl+P", (ev) =>
 
      @$.music.seekPlayOrPause(@latestMouseTime())
 
      @$.music.seekPlayOrPause(@viewState.latestMouseTime())
 
    shortcut.add "Ctrl+Escape", => @viewState.frameAll()
 
    shortcut.add "Shift+Escape", => @viewState.frameToEnd()
 
    shortcut.add "Escape", => @viewState.frameCursor()
 
    shortcut.add "L", =>
 
      @$.adjustersCanvas.updateAllCoords()
 
    shortcut.add 'Delete', =>
0 comments (0 inline, 0 general)