Merge pull request #6337 from tchandelle/drag-box-constraint
Constrain center in DragZoom interaction
This commit is contained in:
@@ -74,9 +74,12 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() {
|
|||||||
var resolution = view.constrainResolution(
|
var resolution = view.constrainResolution(
|
||||||
view.getResolutionForExtent(extent, size));
|
view.getResolutionForExtent(extent, size));
|
||||||
|
|
||||||
|
var center = ol.extent.getCenter(extent);
|
||||||
|
center = view.constrainCenter(center);
|
||||||
|
|
||||||
view.animate({
|
view.animate({
|
||||||
resolution: resolution,
|
resolution: resolution,
|
||||||
center: ol.extent.getCenter(extent),
|
center: center,
|
||||||
duration: this.duration_,
|
duration: this.duration_,
|
||||||
easing: ol.easing.easeOut
|
easing: ol.easing.easeOut
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user