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) { selectBox: function(position) {
var bounds; var bounds;
if (position instanceof OpenLayers.Bounds) { if (position instanceof OpenLayers.Bounds) {
var minXY = this.map.getLonLatFromPixel( var minXY = this.map.getLonLatFromPixel({
new OpenLayers.Pixel(position.left, position.bottom) x: position.left,
); y: position.bottom
var maxXY = this.map.getLonLatFromPixel( });
new OpenLayers.Pixel(position.right, position.top) var maxXY = this.map.getLonLatFromPixel({
); x: position.right,
y: position.top
});
bounds = new OpenLayers.Bounds( bounds = new OpenLayers.Bounds(
minXY.lon, minXY.lat, maxXY.lon, maxXY.lat minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
); );

View File

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