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

[iOS] Enable developers to change position of ornaments #13911

Merged
merged 33 commits into from
Mar 11, 2019

Conversation

lloydsheng
Copy link
Contributor

@lloydsheng lloydsheng commented Feb 12, 2019

The PR was just a copy for #13556. I use the same branch lloyd-ui-position and fixed #13873.

Test on multiple size devices and systems

Device ❌ Navigation Bar ✅ Navigation Bar
iPhone XS Max - 12.1 o5 o4
iPhone X - 12.1 o6 03
iPhone 6 Plus - 9.0 o7 o2
iPhone5 9.0 o8 o1

/cc @chriswu42 @chloekraw

@lloydsheng lloydsheng changed the title [WIP] Enable developers to change position of ornaments [iOS] Enable developers to change position of ornaments Feb 12, 2019
Copy link
Contributor

@julianrex julianrex left a comment

Choose a reason for hiding this comment

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

@captainbarbosa and I have gone over this PR - apart from the following performance concern this looks good.

Please look at removing the call to [self installScaleBarConstraints] in -updateScaleBar - this will probably cause a cascade of changes though - sorry!

platform/ios/CHANGELOG.md Outdated Show resolved Hide resolved
platform/ios/app/MBXOrnamentsViewController.m Outdated Show resolved Hide resolved
platform/ios/app/MBXOrnamentsViewController.m Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.h Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.h Outdated Show resolved Hide resolved
if (@available(iOS 11.0, *)) {
return self.safeAreaLayoutGuide.leadingAnchor;
} else {
return self.leadingAnchor;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why doesn't this and mgl_safeTrailingAnchor also need to check automaticallyAdjustsScrollViewInsets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I was right the automaticallyAdjustsScrollViewInsets just affect the top anchor and the bottom anchor.

Copy link
Contributor

Choose a reason for hiding this comment

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

That I do not know. Can we double check?

platform/ios/test/MGLMapViewLayoutTests.m Outdated Show resolved Hide resolved
platform/ios/test/MGLMapViewLayoutTests.m Outdated Show resolved Hide resolved
platform/ios/test/MGLMapViewLayoutTests.m Outdated Show resolved Hide resolved
platform/ios/test/MGLMapViewLayoutTests.m Show resolved Hide resolved
@friedbunny friedbunny added the iOS Mapbox Maps SDK for iOS label Feb 27, 2019
@friedbunny friedbunny added this to the release-l milestone Feb 27, 2019
Copy link
Contributor

@fabian-guerra fabian-guerra left a comment

Choose a reason for hiding this comment

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

So far this looks good, just minor adjustments.

I tested on iOS 9/11/12, my tests consisted on:

  • Zoom in/out.
  • Modify ornament's offset.
  • Rotating the map.
  • Time profiling.

platform/ios/CHANGELOG.md Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
if (@available(iOS 11.0, *)) {
return self.safeAreaLayoutGuide.leadingAnchor;
} else {
return self.leadingAnchor;
Copy link
Contributor

Choose a reason for hiding this comment

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

That I do not know. Can we double check?

platform/ios/src/MGLMapView.h Outdated Show resolved Hide resolved
return viewController.topLayoutGuide.bottomAnchor;
}
else {
return self.topAnchor;
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC these anchors were introduced in iOS 9. What are your plans for iOS 8?

constant:8.0 + self.contentInset.right]];
[containerView addConstraints:self.attributionButtonConstraints];
- (void)setScaleBarOffset:(CGPoint)scaleBarOffset {
NSAssert(CGRectContainsPoint(self.bounds, scaleBarOffset), @"The position offset of the scale bar should within the mapview boundaries");
Copy link
Contributor

Choose a reason for hiding this comment

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

These asserts don't make sense since the offset is a delta, not a position.

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, we should remove these asserts from this PR and address in a subsequent PR

platform/ios/src/MGLMapView.mm Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
@@ -185,7 +185,7 @@ - (void)commonInit {
#pragma mark - Dimensions

- (CGSize)intrinsicContentSize {
return CGSizeMake(self.actualWidth + self.lastLabelWidth/2, 16);
return CGSizeMake(ceil(self.actualWidth + self.lastLabelWidth/2), 16);
Copy link
Contributor

Choose a reason for hiding this comment

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

MGLPointRounded may be a better choice here than ceil, since it’s meant to account for pixel scale.

platform/ios/test/MGLMapViewLayoutTests.m Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
platform/ios/src/MGLMapView.mm Outdated Show resolved Hide resolved
Copy link
Contributor

@julianrex julianrex left a comment

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ios] Scalebar position and size is incorrect
6 participants