Skip to content

Commit

Permalink
Merge pull request #62 from caplan/develop
Browse files Browse the repository at this point in the history
use correct starting angle for initial user pan check
  • Loading branch information
thiagopnts committed Jan 16, 2018
2 parents c72b367 + 1576c07 commit dd9f55e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/NYT360CameraController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#import "NYT360EulerAngleCalculations.h"
#import "NYT360CameraPanGestureRecognizer.h"

static const CGPoint startingPosition = { 3.14, 0 };

static inline CGFloat distance(CGPoint a, CGPoint b) {
return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
Expand Down Expand Up @@ -48,7 +50,7 @@ - (instancetype)initWithView:(SCNView *)view motionManager:(id<NYT360MotionManag

_pointOfView = view.pointOfView;
_view = view;
_currentPosition = CGPointMake(3.14, 0);
_currentPosition = startingPosition;
_allowedDeviceMotionPanningAxes = NYT360PanningAxisHorizontal | NYT360PanningAxisVertical;
_allowedPanGesturePanningAxes = NYT360PanningAxisHorizontal | NYT360PanningAxisVertical;

Expand Down Expand Up @@ -116,7 +118,7 @@ - (void)updateCameraAngleForCurrentDeviceMotion {
}

static const CGFloat minimalRotationDistanceToReport = 0.75;
if (distance(CGPointZero, self.currentPosition) > minimalRotationDistanceToReport) {
if (distance(startingPosition, self.currentPosition) > minimalRotationDistanceToReport) {
[self reportInitialCameraMovementIfNeededViaMethod:NYT360UserInteractionMethodGyroscope];
}
}
Expand Down

0 comments on commit dd9f55e

Please sign in to comment.