Create new extent if no existing one
This commit is contained in:
+12
-5
@@ -216,11 +216,18 @@ ol.Map.prototype.handleCameraPropertyChanged = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var size = this.size_;
|
var size = this.size_;
|
||||||
var extent = this.extent_;
|
var left = position.x - resolution * size.width / 2;
|
||||||
extent.left = position.x - resolution * size.width / 2;
|
var right = position.x + resolution * size.width / 2;
|
||||||
extent.right = position.x + resolution * size.width / 2;
|
var bottom = position.y - resolution * size.height / 2;
|
||||||
extent.bottom = position.y - resolution * size.height / 2;
|
var top = position.y + resolution * size.height / 2;
|
||||||
extent.top = position.y + resolution * size.height / 2;
|
if (goog.isNull(this.extent_)) {
|
||||||
|
this.extent_ = new ol.Extent(top, right, bottom, left);
|
||||||
|
} else {
|
||||||
|
this.extent_.top = top;
|
||||||
|
this.extent_.right = right;
|
||||||
|
this.extent_.bottom = bottom;
|
||||||
|
this.extent_.left = left;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user