diff --git a/platform/ios/Mapbox.playground/Contents.swift b/platform/ios/Mapbox.playground/Contents.swift index ed48116da9d..23350c73a53 100644 --- a/platform/ios/Mapbox.playground/Contents.swift +++ b/platform/ios/Mapbox.playground/Contents.swift @@ -75,7 +75,7 @@ class MapDelegate: NSObject, MGLMapViewDelegate { let av = PlaygroundAnnotationView(reuseIdentifier: "annotation") av.frame = CGRect(x: 0, y: 0, width: 30, height: 30) av.centerOffset = CGVector(dx: -15, dy: -15) - av.flat = true + av.freeAxes = .X; let centerView = UIView(frame: CGRectInset(av.bounds, 3, 3)) centerView.backgroundColor = UIColor.whiteColor() av.addSubview(centerView) diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index ce1e4ad8465..2145e05c2cb 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -586,12 +586,12 @@ - (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id= 0 && (self.freeAxes & MGLAnnotationViewBillboardAxisX)) { - self.layer.transform = CATransform3DRotate(self.layer.transform, MGLRadiansFromDegrees(camera.pitch), 1.0, 0, 0); + t = CATransform3DRotate(t, MGLRadiansFromDegrees(camera.pitch), 1.0, 0, 0); + } + if (camera.heading >= 0 && (self.freeAxes & MGLAnnotationViewBillboardAxisY)) + { + t = CATransform3DRotate(t, MGLRadiansFromDegrees(-camera.heading), 0.0, 0.0, 1.0); } CGFloat superviewHeight = CGRectGetHeight(self.superview.frame); @@ -117,8 +121,9 @@ - (void)updateTransform // reduction is then normalized for a scale of 1.0. CGFloat pitchAdjustedScale = 1.0 - maxScaleReduction * pitchIntensity; - self.layer.transform = CATransform3DScale(self.layer.transform, pitchAdjustedScale, pitchAdjustedScale, 1); + t = CATransform3DScale(t, pitchAdjustedScale, pitchAdjustedScale, 1); } + self.layer.transform = t; } #pragma mark - Draggable diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 28b030b7dd1..9a41c0946cc 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -4566,6 +4566,9 @@ - (void)updateAnnotationViews [CATransaction begin]; [CATransaction setDisableActions:YES]; + CLLocationDirection direction = self.direction; + CGFloat pitch = self.camera.pitch; + for (auto &pair : _annotationContextsByAnnotationTag) { CGRect viewPort = CGRectInset(self.bounds, @@ -4588,6 +4591,7 @@ - (void)updateAnnotationViews annotationView.center = [self convertCoordinate:annotationContext.annotation.coordinate toPointToView:self]; annotationView.mapView = self; + annotationContext.annotationView = annotationView; } }