Sorry, I attached the wrong version of the patch.

2011/2/4 Adrià Mercader <[email protected]>:
> 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
>



-- 


Adrià Mercader
-----------------------------
http://amercader.net
Index: geoext/lib/GeoExt/widgets/Popup.js
===================================================================
--- geoext/lib/GeoExt/widgets/Popup.js	(revision 2595)
+++ geoext/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,10 @@
             this.location = this.map.getLonLatFromViewPortPx(this.location);
         }
 
+        if (this.location) {
+            this.insideViewport = this.map.getExtent().containsLonLat(this.location);
+        }
+
         if(this.anchored) {
             this.addAnchorEvents();
         }
@@ -223,9 +232,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 +320,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 +371,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