Changeset 345


Ignore:
Timestamp:
04/03/09 18:06:15 (8 years ago)
Author:
tschaub
Message:

If an OpenLayers.Map object is not provided to the MapPanel constructor, we create one with allOverlays set to true. To have the MapPanel create a map with allOverlays false, send a map config object with {allOverlays: true}. r=ahocevar (closes #35)

Location:
core/trunk/geoext
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/trunk/geoext/lib/GeoExt/widgets/MapPanel.js

    r302 r345  
    9999    initComponent: function(){
    100100        if(!(this.map instanceof OpenLayers.Map)) {
    101             this.map = new OpenLayers.Map(this.map);
     101            this.map = new OpenLayers.Map(
     102                Ext.applyIf(this.map || {}, {allOverlays: true})
     103            );
    102104        }
    103105        var layers = this.layers;
  • core/trunk/geoext/tests/lib/GeoExt/widgets/MapPanel.html

    r284 r345  
    4141            t.eq(mapPanel.map.getCenter().toString(), "lon=5,lat=45", "Map center set correctly");
    4242            t.eq(mapPanel.map.getZoom(), 4, "Zoom set correctly");
     43        }
     44       
     45        function test_allOverlays(t) {
     46            t.plan(3);
     47            var map, panel;
     48           
     49            map = new OpenLayers.Map();
     50            panel = new GeoExt.MapPanel({
     51                map: map
     52            });
     53            t.eq(panel.map.allOverlays, false, "allOverlays is not set if map is provided to panel");
     54            panel.destroy();
     55           
     56            panel = new GeoExt.MapPanel({
     57            });
     58            t.eq(panel.map.allOverlays, true, "allOverlays set to true if no map is provided to panel");
     59            panel.destroy();
     60           
     61            panel = new GeoExt.MapPanel({
     62                map: {
     63                    units: "meters"
     64                }
     65            });
     66            t.eq(panel.map.allOverlays, true, "allOverlays set to true if map config is provided to panel");
     67            panel.destroy();
     68           
    4369        }
    4470
Note: See TracChangeset for help on using the changeset viewer.