Don't attempt to fit views to empty extents
This commit is contained in:
@@ -416,10 +416,12 @@ ol.View2D.prototype.getZoom = function() {
|
|||||||
* @todo stability experimental
|
* @todo stability experimental
|
||||||
*/
|
*/
|
||||||
ol.View2D.prototype.fitExtent = function(extent, size) {
|
ol.View2D.prototype.fitExtent = function(extent, size) {
|
||||||
this.setCenter(ol.extent.getCenter(extent));
|
if (!ol.extent.isEmpty(extent)) {
|
||||||
var resolution = this.getResolutionForExtent(extent, size);
|
this.setCenter(ol.extent.getCenter(extent));
|
||||||
resolution = this.constrainResolution(resolution, 0, 0);
|
var resolution = this.getResolutionForExtent(extent, size);
|
||||||
this.setResolution(resolution);
|
resolution = this.constrainResolution(resolution, 0, 0);
|
||||||
|
this.setResolution(resolution);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user