replace Pixel argument with simple object (Map.getLonLatFromViewPortPx)
This commit is contained in:
@@ -213,25 +213,19 @@ OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({
|
|||||||
* bounds of the current viewPort.
|
* bounds of the current viewPort.
|
||||||
*/
|
*/
|
||||||
getExtent: function () {
|
getExtent: function () {
|
||||||
var extent = null;
|
|
||||||
|
|
||||||
|
|
||||||
var size = this.map.getSize();
|
var size = this.map.getSize();
|
||||||
|
var tl = this.getLonLatFromViewPortPx({
|
||||||
|
x: 0, y: 0
|
||||||
|
});
|
||||||
|
var br = this.getLonLatFromViewPortPx({
|
||||||
|
x: size.w, y: size.h
|
||||||
|
});
|
||||||
|
|
||||||
var tlPx = new OpenLayers.Pixel(0,0);
|
if ((tl != null) && (br != null)) {
|
||||||
var tlLL = this.getLonLatFromViewPortPx(tlPx);
|
return new OpenLayers.Bounds(tl.lon, br.lat, br.lon, tl.lat);
|
||||||
|
} else {
|
||||||
var brPx = new OpenLayers.Pixel(size.w, size.h);
|
return null;
|
||||||
var brLL = this.getLonLatFromViewPortPx(brPx);
|
|
||||||
|
|
||||||
if ((tlLL != null) && (brLL != null)) {
|
|
||||||
extent = new OpenLayers.Bounds(tlLL.lon,
|
|
||||||
brLL.lat,
|
|
||||||
brLL.lon,
|
|
||||||
tlLL.lat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return extent;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1517,9 +1517,10 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
*/
|
*/
|
||||||
getCachedCenter: function() {
|
getCachedCenter: function() {
|
||||||
if (!this.center && this.size) {
|
if (!this.center && this.size) {
|
||||||
this.center = this.getLonLatFromViewPortPx(
|
this.center = this.getLonLatFromViewPortPx({
|
||||||
new OpenLayers.Pixel(this.size.w / 2, this.size.h / 2)
|
x: this.size.w / 2,
|
||||||
);
|
y: this.size.h / 2
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return this.center;
|
return this.center;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user