[Commits] r479 - in core/trunk/geoext: examples lib/GeoExt/widgets resources/images/default resources/images/gray tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Mon Apr 27 20:12:28 CEST 2009


Author: sbenthall
Date: 2009-04-27 20:12:28 +0200 (Mon, 27 Apr 2009)
New Revision: 479

Modified:
   core/trunk/geoext/examples/popup.js
   core/trunk/geoext/lib/GeoExt/widgets/Popup.js
   core/trunk/geoext/resources/images/default/anchor.png
   core/trunk/geoext/resources/images/gray/anchor.png
   core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html
Log:
IE fixes for Popups.  Tests now pass. Example works. Anchor graphic transparency works. Thanks to rpenate for the images.  r=tschaub (Closes #21)


Modified: core/trunk/geoext/examples/popup.js
===================================================================
--- core/trunk/geoext/examples/popup.js	2009-04-27 16:53:35 UTC (rev 478)
+++ core/trunk/geoext/examples/popup.js	2009-04-27 18:12:28 UTC (rev 479)
@@ -17,7 +17,7 @@
     var selectCtrl = new OpenLayers.Control.SelectFeature(vectorLayer);
 
     // define "createPopup" function
-    var bogusMarkup = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
+    var bogusMarkup = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
     function createPopup(feature) {
         popup = new GeoExt.Popup({
             title: 'My Popup',

Modified: core/trunk/geoext/lib/GeoExt/widgets/Popup.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/Popup.js	2009-04-27 16:53:35 UTC (rev 478)
+++ core/trunk/geoext/lib/GeoExt/widgets/Popup.js	2009-04-27 18:12:28 UTC (rev 479)
@@ -118,9 +118,7 @@
      */
     initComponent: function() {        
         if (!this.feature && this.lonlat) {
-            this.feature = new OpenLayers.Feature.Vector(
-                new OpenLayers.Geometry.Point(this.lonlat.lon, this.lonlat.lat)
-            );
+            this.feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(this.lonlat.lon, this.lonlat.lat));
         }
 
         this.baseCls = this.popupCls + " " + this.baseCls;
@@ -128,7 +126,6 @@
         this.elements += ',anc';
 
         GeoExt.Popup.superclass.initComponent.call(this);
-
     },
 
     /**
@@ -137,7 +134,6 @@
      */
     onRender: function(ct, position) {
         GeoExt.Popup.superclass.onRender.call(this, ct, position);
-        
         this.ancCls = this.popupCls + "-anc";
 
         //create anchor dom element.
@@ -204,11 +200,10 @@
     setSize: function(w, h) {
         if(this.anc) {
             var ancSize = this.getAnchorElement().getSize();
-            
             if(typeof w == 'object') {
                 h = w.height - ancSize.height;
                 w = w.width;
-            } else {
+            } else if(!isNaN(h)){
                 h = h - ancSize.height;
             }
         }

Modified: core/trunk/geoext/resources/images/default/anchor.png
===================================================================
(Binary files differ)

Modified: core/trunk/geoext/resources/images/gray/anchor.png
===================================================================
(Binary files differ)

Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html	2009-04-27 16:53:35 UTC (rev 478)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html	2009-04-27 18:12:28 UTC (rev 479)
@@ -17,44 +17,43 @@
               }
            )
         }
+       
+        function createMap() {
+            var map = new OpenLayers.Map();
+            var layer = new OpenLayers.Layer("test", {isBaseLayer: true});
+            map.addLayer(layer);
+            return map;
+        }
 
-        function setupContext() {
-            var map = new OpenLayers.Map({
-                projection: new OpenLayers.Projection("EPSG:4326"),                 
-            })
+        function loadMapPanel() {
+            var map = createMap();
 
-            var vector = new OpenLayers.Layer.Vector("Vector Layer",{
-                styleMap: new OpenLayers.StyleMap()
+            mapPanel = new GeoExt.MapPanel({
+                // panel options
+                id: "map-panel",
+                title: "GeoExt MapPanel",
+                renderTo: "mappanel",
+                height: 400,
+                width: 600,
+                // map panel-specific options
+                map: map,
+                center: new OpenLayers.LonLat(5, 45),
+                zoom: 4
             });
 
+            return mapPanel;
+        }
+
+        function setupContext() {        
+            var mapPanel = loadMapPanel();
             var feature = makeFeature();
-        
-            vector.addFeatures(feature);
-            map.addLayers([
-               new OpenLayers.Layer.WMS( 
-                   "OpenLayers WMS",
-                   "http://labs.metacarta.com/wms/vmap0",
-                   {layers: 'basic'} ),
-               vector
-            ]);
+            var map = mapPanel.map;
 
-            var view = new Ext.Viewport({
-                layout : "border",
-                items : [{
-                    xtype: "gx_mappanel",
-                    region: "center",
-                    map : map
-                }]
-            });
-
             return {
                feature : feature,
-               vector : vector,
                map : map,
-               mapPanel : view.items.items[0],
-               view : view
-            };
-           
+               mapPanel : mapPanel
+            };      
         }
 
         function popup(feature){
@@ -76,11 +75,13 @@
 
             var context = setupContext();
 
-            var pop = popup(context.feature, context.mapPanel);
+            var pop = popup(context.feature);
 
             pop.addToMapPanel(context.mapPanel);
 
             t.ok(context.mapPanel.el.child("div." + pop.popupCls),"Map panel contains popup");
+
+            context.mapPanel.destroy();
         }
 
         function test_anchorPopup(t) {
@@ -183,6 +184,6 @@
 
     </script>
   <body>
-    <div id="map"></div>
+    <div id="mappanel"></div>
   </body>
 </html>



More information about the Commits mailing list