changeset 1622:96e0e013e28d

delete key deletes selected notes Ignore-this: dea1199f74a3ac37a150b11a306b8c1f
author Drew Perttula <drewp@bigasterisk.com>
date Fri, 09 Jun 2017 08:25:19 +0000
parents db84c1ee6b09
children c4e990d1dacf
files light9/web/timeline/timeline.coffee
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/timeline/timeline.coffee	Fri Jun 09 05:36:07 2017 +0000
+++ b/light9/web/timeline/timeline.coffee	Fri Jun 09 08:25:19 2017 +0000
@@ -104,6 +104,10 @@
 
     @makeZoomAdjs()
 
+    zoomed = @$.zoomed
+    setupDrop(@$.dia.querySelector('svg'), zoomed.$.rows, @, zoomed.onDrop.bind(zoomed))
+
+
   zoomOrLayoutChanged: ->
     # not for cursor updates
 
@@ -280,7 +284,6 @@
 
   attached: ->
     root = @closest('light9-timeline-editor')
-    setupDrop(@, @$.rows, root, @onDrop.bind(@))
 
   onDrop: (effect, pos) ->
     U = (x) => @graph.Uri(x)
@@ -637,9 +640,13 @@
 
 
   onDel: ->
-    patch = {delQuads: [{subject: @song, predicate: @graph.Uri(':note'), object: @uri, graph: @song}], addQuads: []}
-    @graph.applyAndSendPatch(patch)
+    deleteNote(@graph, @song, @uri)
+
 
+deleteNote = (graph, song, note) ->
+  patch = {delQuads: [{subject: song, predicate: graph.Uri(':note'), object: note, graph: song}], addQuads: []}
+  graph.applyAndSendPatch(patch)
+  
 
 Polymer
   is: 'light9-cursor-canvas'
@@ -873,7 +880,7 @@
     @elemById = {}
 
   attached: ->
-    @querySelector('svg').add
+    
 
   setTimeAxis: (width, yTop, scale) ->
     pxPerTick = 50