changeset 1114:1525c820ee27

annotator annotations even show up now.
author casties
date Fri, 02 Nov 2012 10:51:57 +0100
parents 7affda55c10e
children 526dafa4690d
files webapp/src/main/webapp/jquery/jquery.digilib.annotator.js
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js	Thu Nov 01 18:38:11 2012 +0100
+++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js	Fri Nov 02 10:51:57 2012 +0100
@@ -177,7 +177,7 @@
     /**
      * place annotations on the image
      */
-    var renderAnnotations = function(data) {
+    var renderAnnotations = function (data) {
         console.debug("renderAnnotations: annotator=", annotator);
         if (annotator == null || data.$img == null || data.imgTrafo == null)
             return;
@@ -191,19 +191,20 @@
         if (!data.settings.isAnnotationsVisible) return;
         for (var i = 0; i < annotations.length; i++) {
             var annotation = annotations[i];
-            renderAnnotation(data, annotation);
+            renderAnnotation(data, annotation, i+1);
         }
     };
 
     /**
      * place annotation on the image
      */
-    var renderAnnotation = function(data, annotation) {
+    var renderAnnotation = function (data, annotation, idx) {
         console.debug("renderAnnotation: annotation=", annotation);
         if (annotation == null || data.$img == null || data.imgTrafo == null)
             return;
         var cssPrefix = data.settings.cssPrefix;
         var $elem = data.$elem;
+        if (idx == null) idx = '?';
         // try to show annotation user state
         $elem.find('div#'+cssPrefix+'button-annotationuser').attr('title', 'annotation user: '+data.settings.annotationUser);
         if (!data.settings.isAnnotationsVisible) return;
@@ -212,11 +213,14 @@
             var mpos = data.imgTrafo.transform(pos);
             console.debug("renderannotations: pos=", mpos);
             // create annotation
-            var html = '<div class="' + cssPrefix + 'annotationmark ' + cssPrefix + 'overlay">?</div>';
-            // set text as tooltip
+            var html = '<div class="'+cssPrefix+'annotationmark '+cssPrefix+'overlay annotator-hl">'+idx+'</div>';
             var $annotation = $(html);
-            $annotation.attr('title', "Annotation: " + annotation.text);
+            $annotation.data('annotation', annotation);
+            // set text as tooltip
+            //$annotation.attr('title', "Annotation: " + annotation.text);
             $elem.append($annotation);
+            $annotation.on("mouseover", annotator.onHighlightMouseover);
+            $annotation.on("mouseout", annotator.startViewerHideTimer);
             mpos.adjustDiv($annotation);
         }
     };