summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-07-19 15:22:17 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-07-19 15:22:17 -0700
commit1cf6b5de0c720d2550b4515daed7460f4b51506e (patch)
tree8e3ede72b5d5f8cb06e0bb98728db8fd417c94ab
parent1972d932d5a69f3a9cdf1e76d87d482bdc256373 (diff)
parent59f1b2b210318e204ebb2b7423ae5c0e8790dd3a (diff)
downloadqtlocation-mapboxgl-1cf6b5de0c720d2550b4515daed7460f4b51506e.tar.gz
Merge branch 'release-ios-v3.3.0'
-rw-r--r--platform/ios/CHANGELOG.md16
-rw-r--r--platform/ios/Mapbox-iOS-SDK-symbols.podspec2
-rw-r--r--platform/ios/Mapbox-iOS-SDK.podspec2
-rw-r--r--platform/ios/app/MBXViewController.m2
-rw-r--r--platform/ios/app/Main.storyboard2
-rw-r--r--platform/ios/src/MGLMapView.mm73
-rw-r--r--src/mbgl/map/map.cpp15
-rw-r--r--test/api/annotations.cpp15
8 files changed, 61 insertions, 66 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 8f2e936cde..129db3406f 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -4,17 +4,23 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
## master
-* Fixed a crash that occurred when a sprite URL lacks a file extension. See [this comment](https://github.com/mapbox/mapbox-gl-native/issues/5722#issuecomment-233701251) to determine who may be affected by this bug. ([#5723](https://github.com/mapbox/mapbox-gl-native/pull/5723))
-* Fixed an issue causing overlapping polylines and polygons to be drawn in undefined z-order. Shapes are always drawn in the order they are added to the map, from the oldest on the bottom to the newest on the top. ([#5710](https://github.com/mapbox/mapbox-gl-native/pull/5710))
* As the user zooms in, tiles from lower zoom levels are scaled up until tiles for higher zoom levels are loaded. ([#5143](https://github.com/mapbox/mapbox-gl-native/pull/5143))
* Added [quadkey](https://msdn.microsoft.com/en-us/library/bb259689.aspx) support and limited WMS support in raster tile URL templates. ([#5628](https://github.com/mapbox/mapbox-gl-native/pull/5628))
-* Fixed a crash that occurred when a style or other resource URL has a query string. ([#5554](https://github.com/mapbox/mapbox-gl-native/pull/5554))
-* Fixed an issue causing polyline and polygon annotations to disappear when the zoom level is one less than the maximum zoom level. ([#5418](https://github.com/mapbox/mapbox-gl-native/pull/5418))
-* Added a property to MGLOfflineStorage, `countOfBytesCompleted`, that indicates the disk space occupied by all cached and offline resources. ([#5585](https://github.com/mapbox/mapbox-gl-native/pull/5585))
* The `text-pitch-alignment` property is now supported in stylesheets for improved street label legibility on a tilted map. ([#5288](https://github.com/mapbox/mapbox-gl-native/pull/5288))
* The `icon-text-fit` and `icon-text-fit-padding` properties are now supported in stylesheets, allowing the background of a shield to automatically resize to fit the shield’s text. ([#5334](https://github.com/mapbox/mapbox-gl-native/pull/5334))
* Improved the performance of relocating a non-view-backed point annotation by changing its `coordinate` property. ([#5385](https://github.com/mapbox/mapbox-gl-native/pull/5385))
+## 3.3.1
+
+* Fixed a crash that occurred when a sprite URL lacks a file extension. See [this comment](https://github.com/mapbox/mapbox-gl-native/issues/5722#issuecomment-233701251) to determine who may be affected by this bug. ([#5723](https://github.com/mapbox/mapbox-gl-native/pull/5723))
+* Fixed an issue causing overlapping polylines and polygons to be drawn in undefined z-order. Shapes are always drawn in the order they are added to the map, from the oldest on the bottom to the newest on the top. ([#5710](https://github.com/mapbox/mapbox-gl-native/pull/5710))
+* Fixed an issue preventing MGLMapView from changing its viewport when a single annotation was passed into `-[MGLMapView showAnnotations:animated:]`. ([#5693](https://github.com/mapbox/mapbox-gl-native/pull/5693))
+* Fixed an issue causing polyline and polygon annotations to disappear when the zoom level is one less than the maximum zoom level. ([#5418](https://github.com/mapbox/mapbox-gl-native/pull/5418))
+* Fixed a crash that occurred when a style or other resource URL has a query string. ([#5554](https://github.com/mapbox/mapbox-gl-native/pull/5554))
+* If you subclass MGLAnnotationView, your implementation of `-setSelected:animated:` is now called with the correct value in the `animated` parameter, making it possible to animate a deselection. ([#5677](https://github.com/mapbox/mapbox-gl-native/pull/5677))
+* The compass, Mapbox logo, and attribution button now accommodate the containing map view’s content insets. If your interface elements partially overlap the map view but do not affect the top and bottom layout guides, set the `automaticallyAdjustsScrollViewInsets` property to `NO` and set the `contentInset` property to a suitable value. ([#5671](https://github.com/mapbox/mapbox-gl-native/pull/5671))
+* Added a property to MGLOfflineStorage, `countOfBytesCompleted`, that indicates the disk space occupied by all cached and offline resources. ([#5585](https://github.com/mapbox/mapbox-gl-native/pull/5585))
+
## 3.3.0
### Styles and data
diff --git a/platform/ios/Mapbox-iOS-SDK-symbols.podspec b/platform/ios/Mapbox-iOS-SDK-symbols.podspec
index 85a42ef2b3..1597c9c7af 100644
--- a/platform/ios/Mapbox-iOS-SDK-symbols.podspec
+++ b/platform/ios/Mapbox-iOS-SDK-symbols.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |m|
m.name = 'Mapbox-iOS-SDK'
- m.version = '3.3.0-symbols'
+ m.version = '3.3.1-symbols'
m.summary = 'Open source vector map solution for iOS with full styling capabilities.'
m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.'
diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec
index a461b7e779..8990c2b36a 100644
--- a/platform/ios/Mapbox-iOS-SDK.podspec
+++ b/platform/ios/Mapbox-iOS-SDK.podspec
@@ -1,7 +1,7 @@
Pod::Spec.new do |m|
m.name = 'Mapbox-iOS-SDK'
- m.version = '3.3.0'
+ m.version = '3.3.1'
m.summary = 'Open source vector map solution for iOS with full styling capabilities.'
m.description = 'Open source, OpenGL-based vector map solution for iOS with full styling capabilities and Cocoa Touch APIs.'
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 6158a9a3de..789ee00372 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -411,7 +411,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
{
if (longPress.state == UIGestureRecognizerStateBegan)
{
- /*
CGPoint point = [longPress locationInView:longPress.view];
NSArray *features = [self.mapView visibleFeaturesAtPoint:point];
NSString *title;
@@ -428,7 +427,6 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
pin.subtitle = [[[MGLCoordinateFormatter alloc] init] stringFromCoordinate:pin.coordinate];
// Calling `addAnnotation:` on mapView is not required since `selectAnnotation:animated` has the side effect of adding the annotation if required
[self.mapView selectAnnotation:pin animated:YES];
- */
}
}
diff --git a/platform/ios/app/Main.storyboard b/platform/ios/app/Main.storyboard
index 1190070d8e..7d8b2c304f 100644
--- a/platform/ios/app/Main.storyboard
+++ b/platform/ios/app/Main.storyboard
@@ -79,7 +79,7 @@
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="AAd-8J-9UU" userLabel="First Responder" sceneMemberID="firstResponder"/>
- <pongPressGestureRecognizer allowableMovement="10" minimumPressDuration="0.5" id="lfd-mn-7en">
+ <pongPressGestureRecognizer allowableMovement="10" minimumPressDuration="1" id="lfd-mn-7en">
<connections>
<action selector="handleLongPress:" destination="WaX-pd-UZQ" id="dkk-bc-rvl"/>
</connections>
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 0238ef22be..4c3e192c1e 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -220,6 +220,7 @@ public:
@property (nonatomic) GLKView *glView;
@property (nonatomic) UIImageView *glSnapshotView;
@property (nonatomic, readwrite) UIImageView *compassView;
+@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *compassViewConstraints;
@property (nonatomic, readwrite) UIImageView *logoView;
@property (nonatomic) NS_MUTABLE_ARRAY_OF(NSLayoutConstraint *) *logoViewConstraints;
@property (nonatomic, readwrite) UIButton *attributionButton;
@@ -451,7 +452,6 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
// setup compass
//
_compassView = [[UIImageView alloc] initWithImage:self.compassImage];
- _compassView.frame = { CGPointZero, _compassView.image.size };
_compassView.alpha = 0;
_compassView.userInteractionEnabled = YES;
[_compassView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleCompassTapGesture:)]];
@@ -462,6 +462,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
[container addSubview:_compassView];
container.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:container];
+ _compassViewConstraints = [NSMutableArray array];
// setup interaction
//
@@ -737,40 +738,29 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
// compass
//
UIView *compassContainer = self.compassView.superview;
- [compassContainer removeConstraints:compassContainer.constraints];
+ [constraintParentView removeConstraints:self.compassViewConstraints];
+ [self.compassViewConstraints removeAllObjects];
- NSMutableArray *compassContainerConstraints = [NSMutableArray array];
- if (viewController)
- {
- [compassContainerConstraints addObject:
- [NSLayoutConstraint constraintWithItem:compassContainer
- attribute:NSLayoutAttributeTop
- relatedBy:NSLayoutRelationGreaterThanOrEqual
- toItem:viewController.topLayoutGuide
- attribute:NSLayoutAttributeBottom
- multiplier:1
- constant:5]];
- }
- [compassContainerConstraints addObject:
+ [self.compassViewConstraints addObject:
[NSLayoutConstraint constraintWithItem:compassContainer
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationGreaterThanOrEqual
toItem:self
attribute:NSLayoutAttributeTop
multiplier:1
- constant:5]];
+ constant:5 + self.contentInset.top]];
- [compassContainerConstraints addObject:
+ [self.compassViewConstraints addObject:
[NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeTrailing
relatedBy:NSLayoutRelationEqual
toItem:compassContainer
attribute:NSLayoutAttributeTrailing
multiplier:1
- constant:5]];
+ constant:5 + self.contentInset.right]];
UIImage *compassImage = self.compassView.image;
- [compassContainerConstraints addObject:
+ [self.compassViewConstraints addObject:
[NSLayoutConstraint constraintWithItem:compassContainer
attribute:NSLayoutAttributeWidth
relatedBy:NSLayoutRelationEqual
@@ -779,7 +769,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
multiplier:1
constant:compassImage.size.width]];
- [compassContainerConstraints addObject:
+ [self.compassViewConstraints addObject:
[NSLayoutConstraint constraintWithItem:compassContainer
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
@@ -787,23 +777,13 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1
constant:compassImage.size.height]];
- [constraintParentView addConstraints:compassContainerConstraints];
+ [constraintParentView addConstraints:self.compassViewConstraints];
// logo bug
//
- [self.logoView removeConstraints:self.logoViewConstraints];
+ [constraintParentView removeConstraints:self.logoViewConstraints];
[self.logoViewConstraints removeAllObjects];
- if (viewController)
- {
- [self.logoViewConstraints addObject:
- [NSLayoutConstraint constraintWithItem:viewController.bottomLayoutGuide
- attribute:NSLayoutAttributeTop
- relatedBy:NSLayoutRelationGreaterThanOrEqual
- toItem:self.logoView
- attribute:NSLayoutAttributeBaseline
- multiplier:1
- constant:8]];
- }
+
[self.logoViewConstraints addObject:
[NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeBottom
@@ -811,7 +791,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
toItem:self.logoView
attribute:NSLayoutAttributeBaseline
multiplier:1
- constant:8]];
+ constant:8 + self.contentInset.bottom]];
[self.logoViewConstraints addObject:
[NSLayoutConstraint constraintWithItem:self.logoView
@@ -820,24 +800,14 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
toItem:self
attribute:NSLayoutAttributeLeading
multiplier:1
- constant:8]];
+ constant:8 + self.contentInset.left]];
[constraintParentView addConstraints:self.logoViewConstraints];
// attribution button
//
- [self.attributionButton removeConstraints:self.attributionButtonConstraints];
+ [constraintParentView removeConstraints:self.attributionButtonConstraints];
[self.attributionButtonConstraints removeAllObjects];
- if (viewController)
- {
- [self.attributionButtonConstraints addObject:
- [NSLayoutConstraint constraintWithItem:viewController.bottomLayoutGuide
- attribute:NSLayoutAttributeTop
- relatedBy:NSLayoutRelationGreaterThanOrEqual
- toItem:self.attributionButton
- attribute:NSLayoutAttributeBaseline
- multiplier:1
- constant:8]];
- }
+
[self.attributionButtonConstraints addObject:
[NSLayoutConstraint constraintWithItem:self
attribute:NSLayoutAttributeBottom
@@ -845,7 +815,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
toItem:self.attributionButton
attribute:NSLayoutAttributeBaseline
multiplier:1
- constant:8]];
+ constant:8 + self.contentInset.bottom]];
[self.attributionButtonConstraints addObject:
[NSLayoutConstraint constraintWithItem:self
@@ -854,7 +824,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
toItem:self.attributionButton
attribute:NSLayoutAttributeTrailing
multiplier:1
- constant:8]];
+ constant:8 + self.contentInset.right]];
[constraintParentView addConstraints:self.attributionButtonConstraints];
[super updateConstraints];
@@ -974,6 +944,9 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
[self didUpdateLocationWithUserTrackingAnimated:animated];
}
+
+ // Compass, logo and attribution button constraints needs to be updated.
+ [self setNeedsUpdateConstraints];
}
/// Returns the frame of inset content within the map view.
@@ -3632,7 +3605,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
{
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
annotationView = annotationContext.annotationView;
- annotationView.selected = NO;
+ [annotationView setSelected:NO animated:animated];
}
// clean up
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 5d3a1f3e5d..659832dc77 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -502,13 +502,16 @@ CameraOptions Map::cameraForLatLngs(const std::vector<LatLng>& latLngs, optional
double height = nePixel.y - swPixel.y;
// Calculate the zoom level.
- double scaleX = getWidth() / width;
- double scaleY = getHeight() / height;
- if (padding && *padding) {
- scaleX -= (padding->left + padding->right) / width;
- scaleY -= (padding->top + padding->bottom) / height;
+ double minScale = INFINITY;
+ if (width > 0 || height > 0) {
+ double scaleX = getWidth() / width;
+ double scaleY = getHeight() / height;
+ if (padding && *padding) {
+ scaleX -= (padding->left + padding->right) / width;
+ scaleY -= (padding->top + padding->bottom) / height;
+ }
+ minScale = util::min(scaleX, scaleY);
}
- double minScale = ::fmin(scaleX, scaleY);
double zoom = util::log2(getScale() * minScale);
zoom = util::clamp(zoom, getMinZoom(), getMaxZoom());
diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp
index a1e67b29c4..e3f189c166 100644
--- a/test/api/annotations.cpp
+++ b/test/api/annotations.cpp
@@ -94,6 +94,21 @@ TEST(Annotations, OverlappingFillAnnotation) {
test.checkRendering("overlapping_fill_annotation");
}
+TEST(Annotations, OverlappingFillAnnotation) {
+ AnnotationTest test;
+
+ Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
+ FillAnnotation underlaidAnnotation { polygon };
+ underlaidAnnotation.color = { { 0, 255, 0, 1 } };
+ FillAnnotation overlaidAnnotation { polygon };
+ overlaidAnnotation.color = { { 255, 0, 0, 1 } };
+
+ test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
+ test.map.addAnnotation(underlaidAnnotation);
+ test.map.addAnnotation(overlaidAnnotation);
+ test.checkRendering("overlapping_fill_annotation");
+}
+
TEST(Annotations, StyleSourcedShapeAnnotation) {
AnnotationTest test;