View / add getValidCenter method to improve interactions
The DragPan, KeyboardPan and DragZoom interactions now make sure to animate to a valid center/resolution target to avoid a chained "resolve" animation which looks weird. The `View.fit` method was also fixed to use this.
This commit is contained in:
@@ -80,13 +80,11 @@ function onBoxEnd() {
|
||||
extent = mapExtent;
|
||||
}
|
||||
|
||||
const resolution = view.getResolutionForExtent(extent, size);
|
||||
const zoom = view.getValidZoomLevel(view.getZoomForResolution(resolution));
|
||||
|
||||
const center = getCenter(extent);
|
||||
const resolution = view.getValidResolution(view.getResolutionForExtent(extent, size));
|
||||
const center = view.getValidCenter(getCenter(extent), resolution);
|
||||
|
||||
view.animate({
|
||||
zoom: zoom,
|
||||
resolution: resolution,
|
||||
center: center,
|
||||
duration: this.duration_,
|
||||
easing: easeOut
|
||||
|
||||
Reference in New Issue
Block a user