Fix for Permalink's override-able createParams() function, which was designed to allow for input parameter values for center, zoom, and layers... but was actually only using the center value... zoom and layers were being taken from the map and the input parameters ignored. Big thanks to our anonymous poster for spotting this. r=ahocevar (Pullup #1489)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7986 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -168,8 +168,6 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
createParams: function(center, zoom, layers) {
|
||||
center = center || this.map.getCenter();
|
||||
zoom = zoom || this.map.getZoom();
|
||||
layers = layers || this.map.layers;
|
||||
|
||||
var params = OpenLayers.Util.getParameters(this.base);
|
||||
|
||||
@@ -177,8 +175,11 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||
// Break out of this function, and simply return the params from the
|
||||
// base link.
|
||||
if (center) {
|
||||
|
||||
params.zoom = this.map.getZoom();
|
||||
|
||||
//zoom
|
||||
params.zoom = zoom || this.map.getZoom();
|
||||
|
||||
//lon,lat
|
||||
var lat = center.lat;
|
||||
var lon = center.lon;
|
||||
|
||||
@@ -192,10 +193,12 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
params.lat = Math.round(lat*100000)/100000;
|
||||
params.lon = Math.round(lon*100000)/100000;
|
||||
|
||||
|
||||
//layers
|
||||
layers = layers || this.map.layers;
|
||||
params.layers = '';
|
||||
for (var i=0, len=this.map.layers.length; i<len; i++) {
|
||||
var layer = this.map.layers[i];
|
||||
for (var i=0, len=layers.length; i<len; i++) {
|
||||
var layer = layers[i];
|
||||
|
||||
if (layer.isBaseLayer) {
|
||||
params.layers += (layer == this.map.baseLayer) ? "B" : "0";
|
||||
|
||||
Reference in New Issue
Block a user