From 14912b5a0349ca919463428c27d204d3d934a1d5 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Thu, 5 Sep 2013 23:19:04 +0200 Subject: [PATCH] Annotation selection --- src/shared/annotation.js | 20 ++++++++++++++------ web/viewer.css | 1 - 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/shared/annotation.js b/src/shared/annotation.js index e53164f09..1440d8bb3 100644 --- a/src/shared/annotation.js +++ b/src/shared/annotation.js @@ -571,15 +571,23 @@ var TextAnnotation = (function TextAnnotationClosure() { e.appendChild(document.createElement('br')); } text.appendChild(e); - image.addEventListener('mouseover', function annotationImageOver() { + + var showAnnotation = function showAnnotation() { container.style.zIndex += 1; content.removeAttribute('hidden'); - }, false); + }; - image.addEventListener('mouseout', function annotationImageOut() { - container.style.zIndex -= 1; - content.setAttribute('hidden', true); - }, false); + var hideAnnotation = function hideAnnotation(e) { + if (e.toElement || e.relatedTarget) { // No context menu is used + container.style.zIndex -= 1; + content.setAttribute('hidden', true); + } + }; + + content.addEventListener('mouseover', showAnnotation, false); + content.addEventListener('mouseout', hideAnnotation, false); + image.addEventListener('mouseover', showAnnotation, false); + image.addEventListener('mouseout', hideAnnotation, false); } content.appendChild(title); diff --git a/web/viewer.css b/web/viewer.css index d254dfd86..9ad8b34da 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -1259,7 +1259,6 @@ canvas { } .annotText > img:hover { - cursor: pointer; opacity: 1; }