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

Commit

Permalink
[ios] More experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Jul 6, 2017
1 parent 3d25517 commit b83f9be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion platform/ios/src/MGLAnnotationView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,12 @@ - (void)updateTransform
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))
// {
Expand Down
6 changes: 5 additions & 1 deletion platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5048,12 +5048,16 @@ - (void)updateAnnotationViews
// 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
Expand Down

0 comments on commit b83f9be

Please sign in to comment.