Update OpenLayers.Bounds.containsLonLat input type
'll' parameter can now be either a OpenLayers.LonLat instance or a simple javascript object with a 'lon' and 'lat' properties.
This commit is contained in:
@@ -359,7 +359,8 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||
* APIMethod: containsLonLat
|
||||
*
|
||||
* Parameters:
|
||||
* ll - {<OpenLayers.LonLat>}
|
||||
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||
* object with a 'lon' and 'lat' properties.
|
||||
* options - {Object} Optional parameters
|
||||
*
|
||||
* Acceptable options:
|
||||
@@ -382,13 +383,12 @@ OpenLayers.Bounds = OpenLayers.Class({
|
||||
worldBounds = options.worldBounds;
|
||||
if (worldBounds && !contains) {
|
||||
var worldWidth = worldBounds.getWidth();
|
||||
ll = ll.clone();
|
||||
var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
|
||||
var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
|
||||
ll.lon -= (worldsAway * worldWidth);
|
||||
contains = this.containsLonLat(
|
||||
ll, {inclusive: options.inclusive}
|
||||
);
|
||||
contains = this.containsLonLat({
|
||||
lon: ll.lon - worldsAway * worldWidth,
|
||||
lat: ll.lat
|
||||
}, {inclusive: options.inclusive});
|
||||
}
|
||||
return contains;
|
||||
},
|
||||
|
||||
@@ -267,7 +267,8 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
||||
* Determins whether the feature intersects with the specified location.
|
||||
*
|
||||
* Parameters:
|
||||
* lonlat - {<OpenLayers.LonLat>}
|
||||
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||
* object with a 'lon' and 'lat' properties.
|
||||
* toleranceLon - {float} Optional tolerance in Geometric Coords
|
||||
* toleranceLat - {float} Optional tolerance in Geographic Coords
|
||||
*
|
||||
|
||||
@@ -176,7 +176,8 @@ OpenLayers.Geometry = OpenLayers.Class({
|
||||
* geometry.
|
||||
*
|
||||
* Parameters:
|
||||
* lonlat - {<OpenLayers.LonLat>}
|
||||
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||
* object with a 'lon' and 'lat' properties.
|
||||
* toleranceLon - {float} Optional tolerance in Geometric Coords
|
||||
* toleranceLat - {float} Optional tolerance in Geographic Coords
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user