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

[core][cp] Backport #15097 and #15130 to oolong release #15176

Merged
merged 2 commits into from
Jul 23, 2019

Conversation

astojilj
Copy link
Contributor

[core][cp] Backport #15097 and #15130 to oolong release.
Cherry-pick s cleanly apply.

astojilj added 2 commits July 19, 2019 14:23
To changelog:
Fixed incorrect center coordinate after pinch regression caused by edge insets fix (#14664).

While working on #14664, missed to understand the logic used in

```
                CLLocationCoordinate2D centerCoordinate = _previousPinchCenterCoordinate;
                mbgl::EdgeInsets padding { centerPoint.y, centerPoint.x, self.size.height - centerPoint.y, self.size.width - centerPoint.x };
                self.mbglMap.jumpTo(mbgl::CameraOptions()
                                        .withCenter(MGLLatLngFromLocationCoordinate2D(centerCoordinate))
                                        .withPadding(padding));

```

Replacing this code by moveBy achieves the required translation.

Fixes: #14977, #15082
Viewport center offset usage was wrongly submitted in #14664. It was part of alternative approach that used enlarged viewport. Existing and added tests were not sufficient to spot the regression, since the collision check padding is usually larger than the center offset x and y. Annotation picking has tolerance of only 10 pixels but no annotation integration test was using content insets.

Usage of offset is not needed because `posMatrix` in e.g. `CollisionIndex::projectPoint(const mat4& posMatrix, const Point<float>& point)` already incorporates center offset (projection matrix) and the code in current master was just offsetting all by the value.

Modified [ios] MGLAnnotationViewIntegrationTests.testSelectingAnnotationWithCenterOffset to use different insets. It verifies the fix.

Fixes [iOS] Annotations are not selectable (added via iosapp menu) #15106:

In case of #15106, view's original content insets is {top:88, bottom:34}, causing that center offset is {x:0, y:27} and selection with tolerance of 10 wouldn't select annotation.
After tapping the view, so that the header gets removed, view's content insets get changed to {top:44, bottom:34}, center offset is {x:0, y:5} and annotation selection would work, as described in #15106.

Fixes: #15106
@astojilj astojilj requested review from pozdnyakov, alexshalamov and a team July 19, 2019 11:29
@astojilj astojilj self-assigned this Jul 19, 2019
@astojilj astojilj requested a review from LukasPaczos July 19, 2019 11:44
@friedbunny friedbunny added this to the release-oolong milestone Jul 19, 2019
@friedbunny friedbunny added 🍒 cherry pick Indicates that a PR is a cherry pick. Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl iOS Mapbox Maps SDK for iOS labels Jul 19, 2019
@astojilj astojilj merged commit 75e0b7c into release-oolong Jul 23, 2019
@astojilj astojilj deleted the astojilj-oolong-insets branch July 23, 2019 04:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android 🍒 cherry pick Indicates that a PR is a cherry pick. Core The cross-platform C++ core, aka mbgl iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants