summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/ios/src/MGLAnnotationView.mm7
-rw-r--r--platform/ios/src/MGLMapView.mm6
2 files changed, 11 insertions, 2 deletions
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
index 7eed337702..1fc3bc44e9 100644
--- a/platform/ios/src/MGLAnnotationView.mm
+++ b/platform/ios/src/MGLAnnotationView.mm
@@ -243,7 +243,12 @@ CATransform3D MGLTransform3DFromMatrix4(GLKMatrix4 matrix) {
freeTransform.m34 = -1.0 / (1.0 - furthestDistance * 0.5);
freeTransform = CATransform3DRotate(freeTransform, MGLRadiansFromDegrees(camera.pitch), -1.0, 0, 0);
-// self.layer.anchorPoint = [self convertPoint:self.superview.center toView:self];
+ CGPoint anchorPoint = [self convertPoint:self.superview.center toView:self];
+ anchorPoint.x -= self.center.x;
+ anchorPoint.x /= CGRectGetWidth(self.bounds);
+ anchorPoint.y -= self.center.y;
+ anchorPoint.y /= CGRectGetHeight(self.bounds);
+ self.layer.anchorPoint = anchorPoint;
}
// if (camera.heading >= 0 && (self.freeAxes & MGLAnnotationViewBillboardAxisY))
// {
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 72e471ac80..5e6070df89 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -5048,12 +5048,16 @@ public:
// Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`.
double farZ = furthestDistance * 1.01;
- GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(fov, CGRectGetWidth(self.bounds) / CGRectGetHeight(self.bounds), 1, farZ);
+// GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(fov, CGRectGetWidth(self.bounds) / CGRectGetHeight(self.bounds), 1, farZ);
+// projectionMatrix = GLKMatrix4Translate(projectionMatrix, 0, 0, -cameraToCenterDistance);
+// projectionMatrix = GLKMatrix4RotateX(projectionMatrix, camera.pitch);
// CATransform3D projectionTransform = MGLTransform3DFromMatrix4(projectionMatrix);
CATransform3D projectionTransform = CATransform3DIdentity;
projectionTransform.m34 = -1.0 / (1.0 - furthestDistance * 0.5);
+// projectionTransform = CATransform3DTranslate(projectionTransform, 0, 0, -cameraToCenterDistance);
projectionTransform = CATransform3DRotate(projectionTransform, MGLRadiansFromDegrees(camera.pitch), -1, 0, 0);
+// projectionTransform = CATransform3DScale(projectionTransform, 1, 1, 1.0 / [self metersPerPointAtLatitude:camera.centerCoordinate.latitude]);
// self.annotationContainerView.layer.sublayerTransform = projectionTransform;
// Update the center of visible annotation views