src/widgets/Segments.js
changeset 993 a7efd386872a
parent 990 6a90c96f0b4c
child 994 d18d6b9e1078
--- a/src/widgets/Segments.js	Fri Feb 08 16:38:28 2013 +0100
+++ b/src/widgets/Segments.js	Wed Feb 27 18:39:53 2013 +0100
@@ -22,7 +22,7 @@
     + '<div class="Ldt-Segments-Tooltip"></div>';
 
 IriSP.Widgets.Segments.prototype.annotationTemplate =
-    '<div class="Ldt-Segments-Segment Ldt-TraceMe" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
+    '<div class="Ldt-Segments-Segment Ldt-TraceMe" draggable="true" trace-info="segment-id:{{id}}, media-id:{{media_id}}, from:{{from}}, to:{{to}}" segment-text="{{text}}"'
     + 'style="top:{{top}}px; height:{{height}}px; left:{{left}}px; width:{{width}}px; background:{{medcolor}}" data-base-color="{{color}}" data-low-color="{{lowcolor}}" data-medium-color="{{medcolor}}"></div>'
 
 
@@ -98,6 +98,14 @@
             .click(function() {
                 _annotation.trigger("click");
             })
+            .on("dragstart", function(e) {
+	    	var url = (typeof _annotation.url !== "undefined" 
+	                ? _annotation.url
+	                : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-title",_annotation.title);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-description",_annotation.description);
+	        	e.originalEvent.dataTransfer.setData("text/x-iri-uri",url);
+	        })
             .appendTo(list_$)
         _annotation.on("select", function() {
             _this.$segments.each(function() {