Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Transform::flyTo invalid zoom checks - #9381

Merged
brunoabinader merged 2 commits into
masterfrom
flyto-invalid-zoom-checks
Jun 28, 2017
Merged

brunoabinader merged 2 commits into
masterfrom
flyto-invalid-zoom-checks

Conversation

@brunoabinader

Copy link
Copy Markdown
Contributor

Whilst Transform::easeTo interpolates the zoom from initial to end values (thus never breaching the end value threshold), Transform::flyTo has a "bounce" effect on zoom in some circumstances, by applying a formula on each frame rendering that calculates a new zoom value.

In a particular case e.g. executing flyTo with camera options' zoom level set to the maximum value, the zoom value sometimes goes above the maximum zoom threshold, causing the transform state to become invalid, thus causing this crash in tileCover:

mbgl-glfw: ../../../src/mbgl/util/tile_cover.cpp:159: std::vectormbgl::UnwrappedTileID
mbgl::util::tileCover(const mbgl::TransformState&, int32_t): Assertion `state.valid()' failed.

This PR introduces a clamping to scale boundaries in TransformState::setLatLngZoom, and also a check if the frameZoom is NaN in flyTo (which can occur if the transform state size is empty).

@brunoabinader brunoabinader added bug Core The cross-platform C++ core, aka mbgl labels Jun 28, 2017

@ivovandongen ivovandongen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice timing, ran into this just yesterday when testing some unrelated changes

@brunoabinader
brunoabinader merged commit 1df45a5 into master Jun 28, 2017
@brunoabinader
brunoabinader deleted the flyto-invalid-zoom-checks branch June 28, 2017 18:00
@1ec5

1ec5 commented Jun 28, 2017

Copy link
Copy Markdown
Contributor

Awesome! For reference, I was running into this issue as well in the iPhone 7 simulator (portrait orientation):

  1. Go to z4 around Central Europe.
  2. Set the simulated location to Apple, so that the user’s location is in Cupertino.
  3. Click the location arrow in the toolbar to fly to the user’s location.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Core The cross-platform C++ core, aka mbgl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants