Don't override tileSize, maxExtent and theme when calling

Map.setOptions(). Thanks pspencer for the review. (Closes #1206)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5505 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Frédéric Junod
2007-12-19 07:30:52 +00:00
parent 5c6934b0b0
commit 65ad59a277
2 changed files with 22 additions and 15 deletions
+12 -15
View File
@@ -271,9 +271,19 @@ OpenLayers.Map = OpenLayers.Class({
* (end)
*/
initialize: function (div, options) {
// Simple-type defaults are set in class definition.
// Now set complex-type defaults
this.tileSize = new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,
OpenLayers.Map.TILE_HEIGHT);
//set the default options
this.setOptions(options);
this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
this.theme = OpenLayers._getScriptLocation() +
'theme/default/style.css';
// now override default options
OpenLayers.Util.extend(this, options);
this.id = OpenLayers.Util.createUniqueID("OpenLayers.Map_");
@@ -422,19 +432,6 @@ OpenLayers.Map = OpenLayers.Class({
* options - {Object} Hashtable of options to tag to the map
*/
setOptions: function(options) {
// Simple-type defaults are set in class definition.
// Now set complex-type defaults
this.tileSize = new OpenLayers.Size(OpenLayers.Map.TILE_WIDTH,
OpenLayers.Map.TILE_HEIGHT);
this.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
this.theme = OpenLayers._getScriptLocation() +
'theme/default/style.css';
// now add the options declared by the user
// (these will override defaults)
OpenLayers.Util.extend(this, options);
},