Hi,
I found and issue with hidden popups, as reported on this message from
the users list:

http://www.geoext.org/pipermail/users/2011-February/001964.html

I modified Popup.js to support hiding and reusing the popups (patch attached).
I would like to have a trac account to create a ticket and submit the
patch (and test if necessary) to have it reviewed and eventually
applied. User name amercader would be great.

Thanks!


-- 


Adrià Mercader
-----------------------------
http://amercader.net
Index: lib/GeoExt/widgets/Popup.js
===================================================================
--- lib/GeoExt/widgets/Popup.js	(revision 2595)
+++ lib/GeoExt/widgets/Popup.js	(working copy)
@@ -79,6 +79,11 @@
      */
     location: null,
 
+    /** private: property[insideViewport]
+     *  ``Boolean`` Wether the popup is currently inside the map viewport.
+     */
+    insideViewport: null,
+
     /**
      * Some Ext.Window defaults need to be overriden here
      * because some Ext.Window behavior is not currently supported.
@@ -139,6 +144,8 @@
             this.location = this.map.getLonLatFromViewPortPx(this.location);
         }
 
+        this.insideViewport = this.map.getExtent().containsLonLat(this.location);
+
         if(this.anchored) {
             this.addAnchorEvents();
         }
@@ -223,9 +230,10 @@
      */
     position: function() {
         if(this._mapMove === true) {
-            var visible = this.map.getExtent().containsLonLat(this.location);
-            if(visible !== this.isVisible()) {
-                this.setVisible(visible);
+            this.insideViewport = this.map.getExtent().containsLonLat(this.location);
+            if(this.insideViewport !== this.isVisible()) {
+                this.setVisible(this.insideViewport);
+
             }
         }
 
@@ -310,11 +318,14 @@
     /** private: method[onMapMove]
      */
     onMapMove: function() {
-        this._mapMove = true;
-        this.position();
-        delete this._mapMove;
+        if (!(this.hidden && this.insideViewport)){
+            this._mapMove = true;
+            this.position();
+            delete this._mapMove;            
+        }
+
     },
-    
+
     /** private: method[addAnchorEvents]
      */
     addAnchorEvents: function() {
@@ -358,4 +369,4 @@
 });
 
 /** api: xtype = gx_popup */
-Ext.reg('gx_popup', GeoExt.Popup); 
+Ext.reg('gx_popup', GeoExt.Popup);
_______________________________________________
Dev mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/dev

Reply via email to