[mapguide-commits] r5305 - trunk/MgDev/Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 20 09:45:02 EDT 2010


Author: liuar
Date: 2010-10-20 06:45:01 -0700 (Wed, 20 Oct 2010)
New Revision: 5305

Modified:
   trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
Ticket #1236 "Sticky" tooltips

Submit on behalf of jng

Currently tooltips will always follow the mouse pointer, as a result if there is any interactive content inside the tooltip, it is impossible to actually interact with the said content using the mouse. 

What the tooltip should ideally do is to stay at the position it was first displayed, and only disappear when the mouse pointer leaves the tooltip's bounding box. This is how it's done in Fusion and allows for clicking of any interactive content inside the tooltip. 



Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2010-10-20 13:38:42 UTC (rev 5304)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ	2010-10-20 13:45:01 UTC (rev 5305)
@@ -3520,6 +3520,7 @@
 
 function RequestHyperLinkData(id, x, y, exec)
 {
+    if(IsMouseInsideHyperlink()) return;
     if(lastMapRcv != mapId) return;
     if(isPopupOpen(tbMenu) || isPopupOpen(ctxMenu)) return;
     req = CreateRequestHandler();
@@ -3588,9 +3589,39 @@
 function HideHyperlinkTip()
 {
     tip = document.getElementById("hlTip");
-    if(tip != null) tip.style.visibility = "hidden";
+    if(tip != null) 
+    {
+        if (IsMouseInsideHyperlink())
+        {
+            return;
+        }
+        tip.style.visibility = "hidden";
+    }
 }
 
+function IsMouseInsideHyperlink()
+{
+    tip = document.getElementById("hlTip");
+    var info = document.getElementById("InfoBand");
+    if(tip != null && info != null) 
+    {
+        if (tip.style.visibility == "hidden")
+            return false;
+
+        var xpad = 20;
+        var ypad = 30;
+        var iw = parseInt(info.style.width);
+        var cx = hlData.curx + iw;
+        var cy = hlData.cury;
+        var minx = (parseInt(tip.style.left)) - xpad;
+        var miny = parseInt(tip.style.top) - ypad;
+        var maxx = minx + parseInt(tip.offsetWidth) + xpad;
+        var maxy = miny + parseInt(tip.offsetHeight) + ypad;
+        return (cx >= minx && cx <= maxx && cy >= miny && cy <= maxy);
+    }
+    return false;
+}
+
 function ExecuteHyperlink(url)
 {
     var linkURL;



More information about the mapguide-commits mailing list