[fusion-commits] r1813 - trunk/widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Mar 10 12:14:16 EDT 2009


Author: pdeschamps
Date: 2009-03-10 12:14:16 -0400 (Tue, 10 Mar 2009)
New Revision: 1813

Modified:
   trunk/widgets/Maptip.js
Log:
added init loop so that maptips does not get triggered until the map is 
loaded. 


Modified: trunk/widgets/Maptip.js
===================================================================
--- trunk/widgets/Maptip.js	2009-03-09 16:00:13 UTC (rev 1812)
+++ trunk/widgets/Maptip.js	2009-03-10 16:14:16 UTC (rev 1813)
@@ -62,6 +62,7 @@
     szLabel:'',
     aTextFields: null,
     mapTipFired: false,
+    bStartMapTips:false,
     
     initializeWidget: function(widgetTag) {
         //var json = widgetTag.extension;
@@ -120,6 +121,7 @@
         this.eventListener = false;
         this.getMap().registerForEvent(Fusion.Event.MAP_MAPTIP_REQ_FINISHED,OpenLayers.Function.bind(this._display,this));
         this.getMap().registerForEvent(Fusion.Event.MAP_BUSY_CHANGED, this.busyChanged.bind(this));
+        this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, this.startMapTips.bind(this));
     },
     
     mouseOut: function(e) {
@@ -132,32 +134,37 @@
             }
         }
     },
+
+    startMapTips: function(){
+        this.bStartMapTips = true;
+    },
     
     mouseMove: function(e) {
-        if(!this.eventListener){
-            
-            this.eventListener = true;
-        }
-      //console.log('map tip mouseMove');
-        if (this.bOverTip || this.mouseIsDown) {
-            return;
-        }
-        
-        var map = this.getMap();
-        this.mapSize = map.getSize();
-        this.mapOffset = map._oDomObj.offsets;
+        if( this.bStartMapTips == true){
+            if(!this.eventListener){
+                this.eventListener = true;
+            }
+        //console.log('map tip mouseMove');
+            if (this.bOverTip || this.mouseIsDown) {
+                return;
+            }
 
-        var p = map.getEventPosition(e);
-        this.oCurrentPosition = p;
-        this.oMapTipPosition = p;
+            var map = this.getMap();
+            this.mapSize = map.getSize();
+            this.mapOffset = map._oDomObj.offsets;
 
-        if(typeof( this.nTimer) == "number") {
-            window.clearTimeout(this.nTimer);
-            this.nTimer = null;
-        }
-        
-        this.nTimer = window.setTimeout(OpenLayers.Function.bind(this.showMaptip, this), this.delay);
-        //Event.stop(e);
+            var p = map.getEventPosition(e);
+            this.oCurrentPosition = p;
+            this.oMapTipPosition = p;
+
+            if(typeof( this.nTimer) == "number") {
+                window.clearTimeout(this.nTimer);
+                this.nTimer = null;
+            }
+
+            this.nTimer = window.setTimeout(OpenLayers.Function.bind(this.showMaptip, this), this.delay);
+            //Event.stop(e);
+        } // bStartMapTips 
     },
     
     mouseDown: function() {



More information about the fusion-commits mailing list