|
21 | 21 | CGFloat const JTSImageViewController_DefaultBackgroundBlurRadius = 2.0f;
|
22 | 22 |
|
23 | 23 | // Private Constants
|
24 |
| -CGFloat const JTSImageViewController_MinimumBackgroundScaling = 0.94f; |
25 |
| -CGFloat const JTSImageViewController_TargetZoomForDoubleTap = 3.0f; |
26 |
| -CGFloat const JTSImageViewController_MaxScalingForExpandingOffscreenStyleTransition = 1.25f; |
27 |
| -CGFloat const JTSImageViewController_TransitionAnimationDuration = 0.3f; |
28 |
| -CGFloat const JTSImageViewController_MinimumFlickDismissalVelocity = 800.0f; |
| 24 | +static CGFloat const JTSImageViewController_MinimumBackgroundScaling = 0.94f; |
| 25 | +static CGFloat const JTSImageViewController_TargetZoomForDoubleTap = 3.0f; |
| 26 | +static CGFloat const JTSImageViewController_MaxScalingForExpandingOffscreenStyleTransition = 1.25f; |
| 27 | +static CGFloat const JTSImageViewController_TransitionAnimationDuration = 0.3f; |
| 28 | +static CGFloat const JTSImageViewController_MinimumFlickDismissalVelocity = 800.0f; |
29 | 29 |
|
30 | 30 | typedef struct {
|
31 | 31 | BOOL statusBarHiddenPriorToPresentation;
|
@@ -313,6 +313,26 @@ - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInte
|
313 | 313 | });
|
314 | 314 | }
|
315 | 315 |
|
| 316 | +#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_7_1 |
| 317 | +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator { |
| 318 | + self.lastUsedOrientation = [UIApplication sharedApplication].statusBarOrientation; |
| 319 | + _flags.rotationTransformIsDirty = YES; |
| 320 | + _flags.isRotating = YES; |
| 321 | + typeof(self) __weak weakSelf = self; |
| 322 | + [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
| 323 | + typeof(self) strongSelf = weakSelf; |
| 324 | + [strongSelf cancelCurrentImageDrag:NO]; |
| 325 | + [strongSelf updateLayoutsForCurrentOrientation]; |
| 326 | + [strongSelf updateDimmingViewForCurrentZoomScale:NO]; |
| 327 | + } completion:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
| 328 | + typeof(self) strongSelf = weakSelf; |
| 329 | + JTSImageViewControllerFlags flags = strongSelf.flags; |
| 330 | + flags.isRotating = NO; |
| 331 | + strongSelf.flags = flags; |
| 332 | + }]; |
| 333 | +} |
| 334 | +#endif |
| 335 | + |
316 | 336 | #pragma mark - Setup
|
317 | 337 |
|
318 | 338 | - (void)setupImageAndDownloadIfNecessary:(JTSImageInfo *)imageInfo {
|
@@ -713,8 +733,8 @@ - (void)showImageViewerByScalingDownFromOffscreenPositionWithViewController:(UIV
|
713 | 733 | [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
|
714 | 734 | }
|
715 | 735 |
|
716 |
| - CGFloat scaling = JTSImageViewController_MinimumBackgroundScaling; |
717 |
| - weakSelf.snapshotView.transform = CGAffineTransformConcat(weakSelf.snapshotView.transform, CGAffineTransformMakeScale(scaling, scaling)); |
| 736 | + CGFloat targetScaling = JTSImageViewController_MinimumBackgroundScaling; |
| 737 | + weakSelf.snapshotView.transform = CGAffineTransformConcat(weakSelf.snapshotView.transform, CGAffineTransformMakeScale(targetScaling, targetScaling)); |
718 | 738 |
|
719 | 739 | if (weakSelf.backgroundStyle == JTSImageViewControllerBackgroundStyle_ScaledDimmedBlurred) {
|
720 | 740 | weakSelf.blurredSnapshotView.alpha = 1;
|
@@ -806,8 +826,8 @@ - (void)showAltTextFromViewController:(UIViewController *)viewController {
|
806 | 826 | [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
|
807 | 827 | }
|
808 | 828 |
|
809 |
| - CGFloat scaling = JTSImageViewController_MinimumBackgroundScaling; |
810 |
| - weakSelf.snapshotView.transform = CGAffineTransformConcat(weakSelf.snapshotView.transform, CGAffineTransformMakeScale(scaling, scaling)); |
| 829 | + CGFloat targetScaling = JTSImageViewController_MinimumBackgroundScaling; |
| 830 | + weakSelf.snapshotView.transform = CGAffineTransformConcat(weakSelf.snapshotView.transform, CGAffineTransformMakeScale(targetScaling, targetScaling)); |
811 | 831 |
|
812 | 832 | if (weakSelf.backgroundStyle == JTSImageViewControllerBackgroundStyle_ScaledDimmedBlurred) {
|
813 | 833 | weakSelf.blurredSnapshotView.alpha = 1;
|
|
0 commit comments