Changeset - 02222c96d5ff
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 7 years ago 2018-05-31 22:59:43
drewp@bigasterisk.com
fix mouseout event on notes
Ignore-this: b9dbe5f77b9e100c15e2c65516643149
1 file changed with 20 insertions and 14 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -485,11 +485,11 @@ class Note
 
    @graphics.interactive = true
 
    @container.addChild(@graphics)
 

	
 
    if @uri.equals(@selection.hover())
 
      @_traceBorder(screenPts, 12, 0x888888)
 
    @selection.selected().forEach (s) =>
 
      if s.equals(@uri)
 
        @_traceBorder(screenPts, 8, 0xff2900)
 
    if @uri.equals(@selection.hover())
 
      @_traceBorder(screenPts, 6, 0x888888)
 
        @_traceBorder(screenPts, 6, 0xff2900)
 

	
 
    shape = new PIXI.Polygon(screenPts)
 
    @graphics.beginFill(@_noteColor(effect), .313)
 
@@ -498,17 +498,7 @@ class Note
 

	
 
    @_traceBorder(screenPts, 2, 0xffd900)
 

	
 
    @graphics.on 'mousedown', (ev) =>
 
      log('down gfx', @uri.value)
 
      @_onMouseDown(ev)
 

	
 
    @graphics.on 'mouseover', =>
 
      log('hover', @uri.value)
 
      @selection.hover(@uri)
 

	
 
    @graphics.on 'mouseout', =>
 
      log('hoverout', @uri.value)
 
      @selection.hover(null)
 
    @_addMouseBindings()
 

	
 
    curveWidthCalc = () => @project.curveWidth(worldPts)
 
    @_updateAdjusters(screenPts, worldPts, curveWidthCalc, yForV, @song)
 
@@ -521,6 +511,22 @@ class Note
 
    for p in screenPts.slice(1)
 
      @graphics.lineTo(p.x, p.y)
 

	
 
  _addMouseBindings: () ->
 
    @graphics.on 'mousedown', (ev) =>
 
      @_onMouseDown(ev)
 

	
 
    @graphics.on 'mouseover', =>
 
      if @selection.hover() and @selection.hover().equals(@uri)
 
        # Hovering causes a redraw, which would cause another
 
        # mouseover event.
 
        return
 
      @selection.hover(@uri)
 

	
 
    # mouseout never fires since we rebuild the graphics on mouseover.
 
    @graphics.on 'mousemove', (ev) =>
 
      if @selection.hover() and @selection.hover().equals(@uri) and ev.target != @graphics
 
        @selection.hover(null)
 

	
 
  onUri: ->
 
    @graph.runHandler(@update.bind(@), "note updates #{@uri}")
 

	
0 comments (0 inline, 0 general)