Added LatLngBounds intersects method, closed #350
This commit is contained in:
parent
43a405214c
commit
6f8698b93d
@ -23,6 +23,7 @@ Leaflet Changelog
|
||||
#### API improvements
|
||||
|
||||
* Improved `LatLng` constructor to be more tolerant (and throw descriptive error if latitude or longitude can't be interpreted as a number). [#136](https://github.com/CloudMade/Leaflet/issues/136)
|
||||
* Added `LatLngBounds` `intersects(otherBounds)` method (thanks to [@pagameba](https://github.com/pagameba)). [#350](https://github.com/CloudMade/Leaflet/pull/350)
|
||||
* Added `urlParams` third optional argument to `TileLayer` constructor for convenience: an object with properties that will be evaluated in the URL template.
|
||||
* Added `L.Util.template` method for simple string template evaluation.
|
||||
* Added second argument `inside` to `map` `getBoundsZoom` method that allows you to get appropriate zoom for the view to fit *inside* the given bounds.
|
||||
|
10
dist/leaflet-src.js
vendored
10
dist/leaflet-src.js
vendored
@ -757,6 +757,16 @@ L.LatLngBounds = L.Class.extend({
|
||||
(sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);
|
||||
},
|
||||
|
||||
intersects: function (/*LatLngBounds*/ bounds) {
|
||||
var sw = bounds.getSouthWest(),
|
||||
ne = bounds.getNorthEast(),
|
||||
nw = bounds.getNorthWest(),
|
||||
se = bounds.getSouthEast();
|
||||
|
||||
return this.contains(sw) || this.contains(ne) ||
|
||||
this.contains(nw) || this.contains(se);
|
||||
},
|
||||
|
||||
toBBoxString: function () {
|
||||
var sw = this._southWest,
|
||||
ne = this._northEast;
|
||||
|
2
dist/leaflet.js
vendored
2
dist/leaflet.js
vendored
File diff suppressed because one or more lines are too long
@ -64,6 +64,16 @@ L.LatLngBounds = L.Class.extend({
|
||||
(sw2.lng >= sw.lng) && (ne2.lng <= ne.lng);
|
||||
},
|
||||
|
||||
intersects: function (/*LatLngBounds*/ bounds) {
|
||||
var sw = bounds.getSouthWest(),
|
||||
ne = bounds.getNorthEast(),
|
||||
nw = bounds.getNorthWest(),
|
||||
se = bounds.getSouthEast();
|
||||
|
||||
return this.contains(sw) || this.contains(ne) ||
|
||||
this.contains(nw) || this.contains(se);
|
||||
},
|
||||
|
||||
toBBoxString: function () {
|
||||
var sw = this._southWest,
|
||||
ne = this._northEast;
|
||||
|
Loading…
Reference in New Issue
Block a user