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

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

Merged
lloydsheng merged 33 commits into
masterfrom
lloyd-ui-position
Mar 11, 2019
Merged

lloydsheng merged 33 commits into
masterfrom
lloyd-ui-position

Conversation

@lloydsheng

@lloydsheng lloydsheng commented Feb 12, 2019 •

Copy link
Copy Markdown
Contributor

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 requested review from a team, fabian-guerra and julianrex February 12, 2019 09:39
@lloydsheng lloydsheng changed the title [WIP] Enable developers to change position of ornaments [iOS] Enable developers to change position of ornaments Feb 12, 2019
@captainbarbosa
captainbarbosa self-requested a review February 13, 2019 21:06

@julianrex julianrex 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.

@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!

Comment thread platform/ios/CHANGELOG.md Resolved
Comment thread platform/ios/src/MGLMapView.h Resolved
Comment thread platform/ios/src/MGLMapView.h Resolved
if (@available(iOS 11.0, *)) {
return self.safeAreaLayoutGuide.leadingAnchor;
} else {
return self.leadingAnchor;

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.

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

Copy link
Copy Markdown
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
Copy Markdown
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?

@lloydsheng
lloydsheng requested a review from julianrex February 27, 2019 10:15
@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
Comment thread platform/ios/CHANGELOG.md Resolved

@fabian-guerra fabian-guerra 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.

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.

Comment thread platform/ios/CHANGELOG.md Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
if (@available(iOS 11.0, *)) {
return self.safeAreaLayoutGuide.leadingAnchor;
} else {
return self.leadingAnchor;

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.

That I do not know. Can we double check?

Comment thread platform/ios/src/MGLMapView.h Resolved
return viewController.topLayoutGuide.bottomAnchor;
}
else {
return self.topAnchor;

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.

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

Comment thread platform/ios/src/MGLMapView.mm Outdated
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
Copy Markdown
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
Copy Markdown
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

Comment thread platform/ios/src/MGLMapView.mm Resolved
@julianrex
julianrex requested a review from friedbunny March 6, 2019 15:56
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLScaleBar.mm Outdated

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

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.

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

Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved
Comment thread platform/ios/src/MGLMapView.mm Resolved

@julianrex julianrex 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.

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