replace Pixel argument with simple object (Map.getLonLatFromPixel)

This commit is contained in:
fredj
2012-01-06 15:23:05 +01:00
committed by Frederic Junod
parent 69bc0fc772
commit a111808e06
3 changed files with 24 additions and 16 deletions

View File

@@ -299,12 +299,14 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
selectBox: function(position) {
var bounds;
if (position instanceof OpenLayers.Bounds) {
var minXY = this.map.getLonLatFromPixel(
new OpenLayers.Pixel(position.left, position.bottom)
);
var maxXY = this.map.getLonLatFromPixel(
new OpenLayers.Pixel(position.right, position.top)
);
var minXY = this.map.getLonLatFromPixel({
x: position.left,
y: position.bottom
});
var maxXY = this.map.getLonLatFromPixel({
x: position.right,
y: position.top
});
bounds = new OpenLayers.Bounds(
minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
);

View File

@@ -535,12 +535,14 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
*/
selectBox: function(position) {
if (position instanceof OpenLayers.Bounds) {
var minXY = this.map.getLonLatFromPixel(
new OpenLayers.Pixel(position.left, position.bottom)
);
var maxXY = this.map.getLonLatFromPixel(
new OpenLayers.Pixel(position.right, position.top)
);
var minXY = this.map.getLonLatFromPixel({
x: position.left,
y: position.bottom
});
var maxXY = this.map.getLonLatFromPixel({
x: position.right,
y: position.top
});
var bounds = new OpenLayers.Bounds(
minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
);

View File

@@ -63,10 +63,14 @@ OpenLayers.Control.ZoomBox = OpenLayers.Class(OpenLayers.Control, {
if (position instanceof OpenLayers.Bounds) {
var bounds;
if (!this.out) {
var minXY = this.map.getLonLatFromPixel(
new OpenLayers.Pixel(position.left, position.bottom));
var maxXY = this.map.getLonLatFromPixel(
new OpenLayers.Pixel(position.right, position.top));
var minXY = this.map.getLonLatFromPixel({
x: position.left,
y: position.bottom
});
var maxXY = this.map.getLonLatFromPixel({
x: position.right,
y: position.top
});
bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat,
maxXY.lon, maxXY.lat);
} else {