Changeset - ab025bf6c3df
[Not reviewed]
default
0 2 0
Drew Perttula - 8 years ago 2017-06-07 07:41:06
drewp@bigasterisk.com
let svg receive mouse events in prep for selection support
Ignore-this: a4890b7effd0aa31868eb161f71a49fb
2 files changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
light9/web/timeline/timeline-elements.html
Show inline comments
 
@@ -133,18 +133,16 @@
 
     wrong in the case of notes?)
 
   -->
 
<dom-module id="light9-timeline-diagram-layer">
 
  <template>
 
    <style>
 
     :host {
 
         pointer-events: none;
 
     }
 
     svg {
 
         width: 100%;
 
         height: 100%;
 
         pointer-events: none;
 
     }
 
    </style>
 
    <svg xmlns="http://www.w3.org/2000/svg"
 
         xmlns:svg="http://www.w3.org/2000/svg"
 
         xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" >
 
      <g id="layer1">
light9/web/timeline/timeline.coffee
Show inline comments
 
@@ -93,13 +93,13 @@ Polymer
 
    @dia = @$.dia
 
    ko.computed(@zoomOrLayoutChanged.bind(@))
 
    ko.computed(@songTimeChanged.bind(@))
 

	
 
    @trackMouse()
 
    @bindKeys()
 
    @bindWheelZoom()
 
    @bindWheelZoom(@dia.querySelector('svg'))
 
    @forwardMouseEventsToAdjustersCanvas()
 

	
 
    @makeZoomAdjs()
 

	
 
  zoomOrLayoutChanged: ->
 
    # not for cursor updates
 
@@ -152,14 +152,14 @@ Polymer
 
      @$.vidrefTime.generateRequest()
 
      @$.vidrefLastSent = now
 

	
 
  latestMouseTime: ->
 
    @zoomInX.invert(@viewState.mouse.pos().e(1))
 

	
 
  bindWheelZoom: ->
 
    @$.zoomed.addEventListener 'mousewheel', (ev) =>
 
  bindWheelZoom: (elem) ->
 
    elem.addEventListener 'mousewheel', (ev) =>
 
      zs = @viewState.zoomSpec
 

	
 
      center = @latestMouseTime()
 
      left = center - zs.t1()
 
      right = zs.t2() - center
 
      scale = Math.pow(1.005, ev.deltaY)
 
@@ -893,12 +893,15 @@ Polymer
 
  # note boxes
 
  is: 'light9-timeline-diagram-layer'
 
  properties: {}
 
  ready: ->
 
    @elemById = {}
 

	
 
  attached: ->
 
    @querySelector('svg').add
 

	
 
  setTimeAxis: (width, yTop, scale) ->
 
    pxPerTick = 50
 
    axis = d3.axisTop(scale).ticks(width / pxPerTick)
 
    d3.select(@$.timeAxis).attr('transform', 'translate(0,'+yTop+')').call(axis)
 

	
 
  getOrCreateElem: (uri, groupId, tag, attrs) ->
0 comments (0 inline, 0 general)