[core] Fix tileCover / TileCoordinate fromScreenCoordinate(#15442)

Remove unecessary tile coordinate unproject -> project  step.
Unproject+project isn't always a noop and this was the issue leading to wrong cover calculation in high pitch values.

Fixes: https://github.com/mapbox/mapbox-gl-native/issues/15442
This commit is contained in:
Aleksandar Stojiljkovic
2019-08-23 12:04:32 +03:00
parent 13d2667035
commit 9eff849c74
6 changed files with 41 additions and 16 deletions

View File

@@ -43,6 +43,20 @@ TEST(TileCover, Pitch) {
util::tileCover(transform.getState(), 2));
}
TEST(TileCover, PitchIssue15442) {
Transform transform;
transform.resize({ 412, 691 });
transform.jumpTo(CameraOptions().withCenter(LatLng { 59.116898740996106, 91.565660781803615, })
.withZoom(2.0551126748417214).withBearing(0.74963938256567264 * util::RAD2DEG)
.withPitch(1.0471975511965976 * util::RAD2DEG));
EXPECT_EQ((std::vector<UnwrappedTileID>{
{ 2, 3, 1 }, { 2, 2, 1 }, { 2, 3, 0 }, { 2, 2, 0 }, { 1, { 2, 0, 0 } }, { 1, { 2, 1, 0 } }
}),
util::tileCover(transform.getState(), 2));
}
TEST(TileCover, PitchOverAllowedByContentInsets) {
Transform transform;
transform.resize({ 512, 512 });