Skip to content

Commit

Permalink
use correct starting angle for initial user pan check
Browse files Browse the repository at this point in the history
  • Loading branch information
caplan committed Jan 16, 2018
1 parent c72b367 commit 1576c07
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

1 comment on commit 1576c07

@caplan
Copy link
Contributor Author

@caplan caplan commented on 1576c07 Jan 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixes #58

Please sign in to comment.