Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not interpolate zoom during flyTo when start and end zoom are same #2479

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

### 🐞 Bug fixes

- Fixes crash that happened with some PBF files ([Issue](https://github.com/maplibre/maplibre-native/issues/795), [PR](https://github.com/maplibre/maplibre-native/pull/2460)).
- Fixes crash that happened with some PBF files ([Issue](https://github.com/maplibre/maplibre-native/issues/795), [PR](https://github.com/maplibre/maplibre-native/pull/2460)).
- Fix blinking issue caused by `flyTo` transition when start and end zoom are the same ([#2477](https://github.com/maplibre/maplibre-native/issues/2477)).

## 11.0.0

Expand Down
10 changes: 5 additions & 5 deletions src/mbgl/map/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ void Transform::flyTo(const CameraOptions& camera, const AnimationOptions& anima

// Calculate the current point and zoom level along the flight path.
Point<double> framePoint = util::interpolate(startPoint, endPoint, us);
double frameZoom = linearZoomInterpolation ? util::interpolate(startZoom, zoom, k)
: startZoom + state.scaleZoom(1 / w(s));

// Zoom can be NaN if size is empty.
if (std::isnan(frameZoom)) {
frameZoom = zoom;
}
// also do not interpolate if start and end zoom are the same
// (https://github.com/maplibre/maplibre-native/issues/2477)
double frameZoom = std::isnan(zoom) || zoom == startZoom ? zoom
: linearZoomInterpolation ? util::interpolate(startZoom, zoom, k)
: startZoom + state.scaleZoom(1 / w(s));

// Convert to geographic coordinates and set the new viewpoint.
LatLng frameLatLng = Projection::unproject(framePoint, startScale);
Expand Down
Loading