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

[core] Harden Transform anchor & padding usage#4285

Merged
brunoabinader merged 6 commits into
masterfrom
brunoabinader-transform-utests
Mar 14, 2016
Merged

[core] Harden Transform anchor & padding usage#4285
brunoabinader merged 6 commits into
masterfrom
brunoabinader-transform-utests

Conversation

@brunoabinader
Copy link
Copy Markdown
Contributor

Enforce invalid anchors via ScreenCoordinate::null() when neeeded, backed up by unit tests. This patch reverts some more changes from b33b2f1 related to the default value for Transform functions. As pointed out by Minh, we use invalid screen coordinates to tell the affected transform functions to use the origin instead.

/cc @1ec5 @kkaefer

@jfirebaugh
Copy link
Copy Markdown
Contributor

We should be using optional<ScreenCoordinate> for optional ScreenCoordinates, not a vec2<double> containing NaNs.

Use optional values for anchor & padding in Map and Transform functions
instead of NaNs. Added unit tests to stress some edge cases.
Simplify LatLng::{wrap,unwrapForShortestPath} code, avoiding duplicated
code between Transform::{latLngToScreenCoordinate,easeTo,flyTo}.

Added unit tests for camera usage in Transform to detect cases like e.g.
crossing the antimeridian as a shortest path between two coordinates.

Transform::flyTo precision loss to be handled in #4298.
If gesture in progress, we transfer the world rounds from the end
longitude into start, so we can guarantee the "scroll effect" of
rounding the world while assuring the end longitude remains wrapped.
Otherwise, find the shortest path.
@brunoabinader brunoabinader force-pushed the brunoabinader-transform-utests branch from 90b3f0d to 7a509b0 Compare March 14, 2016 09:51
@brunoabinader
Copy link
Copy Markdown
Contributor Author

TL;DR: If gesturing, do what the user wants, instead take the shortest path.

@1ec5 this fixes the shortest path code I broke in 026b6d4, together with an issue where a user gesture of scrolling around the world would have unexpected behavior due to the shortest path algorithm. We use isGestureInProgress() to ignore that and instead transfer the world rounds from the end longitude into start, so we still get the scrolling effect while assuring that the end longitude remains wrapped.

This fixes an issue in both iOS and Android when e.g. adding a marker on
both sides of the dateline border in Taveuni island, the marker in one
of the sides would have an out-of-bounds longitude.
@brunoabinader
Copy link
Copy Markdown
Contributor Author

Annotation tooltips are shown in both sides of the dateline with wrapped longitudes now:
new

@brunoabinader brunoabinader changed the title [core] Harden Transform anchor usage [core] Harden Transform anchor & padding usage Mar 14, 2016
@brunoabinader
Copy link
Copy Markdown
Contributor Author

@bleege @tobrun I believe this should be on android-v4.0.0 milestone too.

@1ec5
Copy link
Copy Markdown
Contributor

1ec5 commented Mar 14, 2016

That makes a lot of sense. Thanks @brunoabinader!

@brunoabinader brunoabinader merged commit fc0a0ef into master Mar 14, 2016
@brunoabinader brunoabinader deleted the brunoabinader-transform-utests branch March 14, 2016 14:19
@bleege
Copy link
Copy Markdown
Contributor

bleege commented Mar 14, 2016

👍 @brunoabinader

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants