[fusion-commits] r1724 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Dec 18 15:58:20 EST 2008


Author: pagameba
Date: 2008-12-18 15:58:20 -0500 (Thu, 18 Dec 2008)
New Revision: 1724

Modified:
   trunk/widgets/Maptip.js
Log:
Re #196.  Also suppress the maptip when the mouse moves while down.

Modified: trunk/widgets/Maptip.js
===================================================================
--- trunk/widgets/Maptip.js	2008-12-18 20:44:01 UTC (rev 1723)
+++ trunk/widgets/Maptip.js	2008-12-18 20:58:20 UTC (rev 1724)
@@ -56,7 +56,7 @@
     aLayers: null,
     bOverTip: false,
     sWinFeatures: 'menubar=no,location=no,resizable=no,status=no',
-    offset: new OpenLayers.Pixel(0,20),
+    offset: new OpenLayers.Pixel(2,20),
     
     initializeWidget: function(widgetTag) {
         var json = widgetTag.extension;
@@ -100,7 +100,8 @@
         document.getElementsByTagName('BODY')[0].appendChild(this.domObj);
         
         this.getMap().observeEvent('mousemove', OpenLayers.Function.bind(this.mouseMove, this));
-        this.getMap().observeEvent('mousedown', OpenLayers.Function.bind(this._hide, this));
+        this.getMap().observeEvent('mousedown', OpenLayers.Function.bind(this.mouseDown, this));
+        this.getMap().observeEvent('mouseup', OpenLayers.Function.bind(this.mouseUp, this));
         this.getMap().observeEvent('mouseout', OpenLayers.Function.bind(this.mouseOut, this));
         
     },
@@ -118,7 +119,7 @@
     
     mouseMove: function(e) {
       //console.log('map tip mouseMove');
-        if (this.bOverTip) {
+        if (this.bOverTip || this.mouseIsDown) {
             return;
         }
         
@@ -137,6 +138,15 @@
         //Event.stop(e);
     },
     
+    mouseDown: function() {
+        this.mouseIsDown = true;
+        this._hide();
+    },
+    
+    mouseUp: function() {
+        this.mouseIsDown = false;
+    },
+    
     showMaptip: function(r) {
       //console.log('showMaptip');
         var map = this.getMap();
@@ -186,6 +196,10 @@
     },
     
     _display: function(tooltip) {
+        if (this.mouseIsDown) {
+            return;
+        }
+        
       //console.log('maptip _display');
             this.domObj.innerHTML = ' ';
             var contentDiv = document.createElement('div');



More information about the fusion-commits mailing list