summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-06-28 21:54:05 -0700
committerMinh Nguyễn <mxn@1ec5.org>2017-07-05 18:33:00 -0700
commitb83f9be12088ef7ebd231e49db8b0bc76095429b (patch)
treec8e978ef0af61654d2557878633dc5b4d88c9abd
parent3d255176c549f96a17d05c8e5240067f7c2ad0f4 (diff)
downloadqtlocation-mapboxgl-upstream/1ec5-annotation-cleanup.tar.gz
[ios] More experimentsupstream/1ec5-annotation-cleanup
-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