[Commits] r1284 - in core/trunk/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Fri Jul 24 09:45:03 CEST 2009


Author: ahocevar
Date: 2009-07-24 09:45:03 +0200 (Fri, 24 Jul 2009)
New Revision: 1284

Modified:
   core/trunk/geoext/lib/GeoExt/widgets/Popup.js
   core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html
Log:
fixed anchoring issue with Ext3, caused by imporper usage of Panel.createElement. r=tschaub,elemoine (closes #125)

Modified: core/trunk/geoext/lib/GeoExt/widgets/Popup.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/Popup.js	2009-07-23 20:07:20 UTC (rev 1283)
+++ core/trunk/geoext/lib/GeoExt/widgets/Popup.js	2009-07-24 07:45:03 UTC (rev 1284)
@@ -145,7 +145,7 @@
         this.ancCls = this.popupCls + "-anc";
 
         //create anchor dom element.
-        this.createElement("anc", this.el);
+        this.createElement("anc", this.el.dom);
     },
 
     /** private: method[initTools]
@@ -184,7 +184,7 @@
      */
     setSize: function(w, h) {
         if(this.anc) {
-            var ancSize = this.getAnchorElement().getSize();
+            var ancSize = this.anc.getSize();
             if(typeof w == 'object') {
                 h = w.height - ancSize.height;
                 w = w.width;
@@ -214,12 +214,8 @@
     
             //This works for positioning with the anchor on the bottom.
             
-            //Will have to functionalize this out later and allow
-            //for other positions relative to the feature.
-            var anchorSelector = "div." + this.ancCls;
-    
-            var dx = this.anc.down(anchorSelector).getLeft(true) +
-                                this.anc.down(anchorSelector).getWidth() / 2;
+            var anc = this.anc;
+            var dx = anc.getLeft(true) + anc.getWidth() / 2;
             var dy = this.el.getHeight();
     
             //Assuming for now that the map viewport takes up
@@ -228,15 +224,6 @@
         }
     },
 
-    /** private: method[getAnchorElement]
-     *  :returns: ``Ext.Element``  The anchor element of the popup.
-     */
-    getAnchorElement: function() {
-        var anchorSelector = "div." + this.ancCls;
-        var anc = Ext.get(this.el.child(anchorSelector));
-        return anc;
-    },
-
     /** private: method[unanchorPopup]
      *  Unanchors a popup from its feature.  This removes the popup from its
      *  MapPanel and adds it to the page body.
@@ -250,7 +237,7 @@
         this.dd = new Ext.Window.DD(this);
 
         //remove anchor
-        this.getAnchorElement().remove();
+        this.anc.remove();
         this.anc = null;
 
         //hide unpin tool

Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html	2009-07-23 20:07:20 UTC (rev 1283)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html	2009-07-24 07:45:03 UTC (rev 1284)
@@ -93,7 +93,7 @@
                 scope : this
             });
 
-            t.ok(pop.getAnchorElement(), "Popup has anchor element");
+            t.ok(pop.anc, "Popup has anchor element");
 
             // move the map and confirm that popup moves
             context.map.setCenter(new OpenLayers.LonLat(6, 45));
@@ -139,7 +139,7 @@
 
             var newPos = pop.getPosition();
 
-            t.ok(!pop.getAnchorElement(),"Anchor element removed");
+            t.ok(!pop.anc,"Anchor element removed");
             t.ok(!this.collapsed, "Preserved collapsed state");
             t.eq(origPos[0],newPos[0],"Popup remains in same position (X)");
             t.eq(origPos[1],newPos[1],"Popup remains in same position (Y)");



More information about the Commits mailing list