[android] fixed horizontal panning going the opposite direction
This commit is contained in:
@@ -1651,20 +1651,17 @@ public class MapView extends FrameLayout {
|
||||
|
||||
resetTrackingModesIfRequired(true, false);
|
||||
|
||||
// Fling the map
|
||||
float ease = 0.25f;
|
||||
|
||||
velocityX = velocityX * ease;
|
||||
velocityY = velocityY * ease;
|
||||
|
||||
double speed = Math.sqrt(velocityX * velocityX + velocityY * velocityY);
|
||||
double deceleration = 2500;
|
||||
double duration = speed / (deceleration * ease);
|
||||
double decelerationRate = 1;
|
||||
|
||||
// Cancel any animation
|
||||
cancelTransitions();
|
||||
|
||||
nativeMapView.moveBy(velocityX * duration / 2.0 / screenDensity, velocityY * duration / 2.0 / screenDensity, (long) (duration * 1000.0f));
|
||||
double offsetX = velocityX * decelerationRate / 4 / screenDensity;
|
||||
double offsetY = velocityY * decelerationRate / 4 / screenDensity;
|
||||
|
||||
nativeMapView.setGestureInProgress(true);
|
||||
nativeMapView.moveBy(offsetX, offsetY, (long) (decelerationRate * 1000.0f));
|
||||
nativeMapView.setGestureInProgress(false);
|
||||
|
||||
MapboxMap.OnFlingListener listener = mapboxMap.getOnFlingListener();
|
||||
if (listener != null) {
|
||||
|
||||
Reference in New Issue
Block a user