|
@@ -123,6 +123,10 @@
|
|
@property (nonatomic) NSLock *stitchkLock;
|
|
@property (nonatomic) NSLock *stitchkLock;
|
|
@property (nonatomic) LenVideoStitchResult stitchResult;
|
|
@property (nonatomic) LenVideoStitchResult stitchResult;
|
|
|
|
|
|
|
|
+
|
|
|
|
+@property (nonatomic) NSNumber *startPitchX;
|
|
|
|
+@property (nonatomic) NSNumber *startRollY;
|
|
|
|
+
|
|
@end
|
|
@end
|
|
|
|
|
|
@implementation PCSBaseViewController
|
|
@implementation PCSBaseViewController
|
|
@@ -164,8 +168,8 @@
|
|
|
|
|
|
self.resourceModel = [[LenzCachedResourceModel alloc]init];
|
|
self.resourceModel = [[LenzCachedResourceModel alloc]init];
|
|
self.motionManager = [[CMMotionManager alloc]init];
|
|
self.motionManager = [[CMMotionManager alloc]init];
|
|
- self.motionManager.deviceMotionUpdateInterval = 1/5.0;
|
|
|
|
-
|
|
|
|
|
|
+ self.motionManager.deviceMotionUpdateInterval = 1/5;
|
|
|
|
+
|
|
// self.resultDict = [NSMutableDictionary dictionary];
|
|
// self.resultDict = [NSMutableDictionary dictionary];
|
|
|
|
|
|
if (!JK_IS_IPHONE_X) {
|
|
if (!JK_IS_IPHONE_X) {
|
|
@@ -798,25 +802,40 @@
|
|
|
|
|
|
if (self.motionManager.deviceMotionAvailable) {
|
|
if (self.motionManager.deviceMotionAvailable) {
|
|
__weak typeof(self)wearSelf = self;
|
|
__weak typeof(self)wearSelf = self;
|
|
|
|
+
|
|
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion * _Nullable motion, NSError * _Nullable error) {
|
|
[self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion * _Nullable motion, NSError * _Nullable error) {
|
|
- CGFloat x = motion.rotationRate.x;
|
|
|
|
- CGFloat y = motion.rotationRate.y;
|
|
|
|
|
|
+ if (!self.startPitchX && !self.startRollY) {
|
|
|
|
+ self.startPitchX = @(motion.attitude.pitch * 100);
|
|
|
|
+ self.startRollY = @(motion.attitude.roll *100);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ double x = self.startPitchX.doubleValue - motion.attitude.pitch * 100;
|
|
|
|
+ double y = self.startRollY.doubleValue - motion.attitude.roll * 100;
|
|
|
|
+
|
|
LenVideoStitchDirction dir = (LenVideoStitchDirction)wearSelf.panoramOrientationGuideView.selectedItemIndex;
|
|
LenVideoStitchDirction dir = (LenVideoStitchDirction)wearSelf.panoramOrientationGuideView.selectedItemIndex;
|
|
if (dir == LenVideoStitchDirctionLeft || dir == LenVideoStitchDirctionRight) {
|
|
if (dir == LenVideoStitchDirctionLeft || dir == LenVideoStitchDirctionRight) {
|
|
- if (fabs(x) < 0.05) {
|
|
|
|
|
|
+ if (fabs(x) < 3) {
|
|
|
|
+ NSLog(@"~~~~~~~~~~水平");
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirCenter dir:dir];
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirCenter dir:dir];
|
|
- } else if (x > 0) {
|
|
|
|
- [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirUp dir:dir];
|
|
|
|
} else {
|
|
} else {
|
|
- [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirDown dir:dir];
|
|
|
|
|
|
+ if (x > 0) {
|
|
|
|
+ NSLog(@"~~~~~~~~~~向下");
|
|
|
|
+ [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirDown dir:dir];
|
|
|
|
+ } else {
|
|
|
|
+ NSLog(@"~~~~~~~~~~向上");
|
|
|
|
+ [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirUp dir:dir];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else if (dir == LenVideoStitchDirctionUp || dir == LenVideoStitchDirctionDown) {
|
|
} else if (dir == LenVideoStitchDirctionUp || dir == LenVideoStitchDirctionDown) {
|
|
- if (fabs(y) < 0.05) {
|
|
|
|
|
|
+
|
|
|
|
+ if (fabs(y) < 3) {
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirCenter dir:dir];
|
|
[wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirCenter dir:dir];
|
|
- } else if (y > 0) {
|
|
|
|
- [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirLeft dir:dir];
|
|
|
|
} else {
|
|
} else {
|
|
- [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirRight dir:dir];
|
|
|
|
|
|
+ if (y > 0) {
|
|
|
|
+ [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirLeft dir:dir];
|
|
|
|
+ } else {
|
|
|
|
+ [wearSelf.panoramaGuideView updateArrowWith:PanoramaArrowDirRight dir:dir];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|