forked from venj/Remote-Helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMWPhotoBrowser.patch
110 lines (100 loc) · 4.3 KB
/
MWPhotoBrowser.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
diff --git a/Pods/MWPhotoBrowser/Pod/Classes/MWPhoto.m b/Pods/MWPhotoBrowser/Pod/Classes/MWPhoto.m
index 049d836..02242e7 100644
--- a/Pods/MWPhotoBrowser/Pod/Classes/MWPhoto.m
+++ b/Pods/MWPhotoBrowser/Pod/Classes/MWPhoto.m
@@ -191,7 +191,7 @@
@try {
SDWebImageManager *manager = [SDWebImageManager sharedManager];
_webImageOperation = [manager downloadImageWithURL:url
- options:0
+ options:SDWebImageAllowInvalidSSLCertificates
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
if (expectedSize > 0) {
float progress = receivedSize / (float)expectedSize;
diff --git a/Pods/MWPhotoBrowser/Pod/Classes/MWZoomingScrollView.m b/Pods/MWPhotoBrowser/Pod/Classes/MWZoomingScrollView.m
index 86aa735..f5216b3 100644
--- a/Pods/MWPhotoBrowser/Pod/Classes/MWZoomingScrollView.m
+++ b/Pods/MWPhotoBrowser/Pod/Classes/MWZoomingScrollView.m
@@ -267,27 +267,13 @@
maxScale = 4;
}
- // Image is smaller than screen so no zooming!
- if (xScale >= 1 && yScale >= 1) {
- minScale = 1.0;
- }
-
// Set min/max zoom
self.maximumZoomScale = maxScale;
self.minimumZoomScale = minScale;
// Initial zoom
self.zoomScale = [self initialZoomScaleWithMinScale];
-
- // If we're zooming to fill then centralise
- if (self.zoomScale != minScale) {
-
- // Centralise
- self.contentOffset = CGPointMake((imageSize.width * self.zoomScale - boundsSize.width) / 2.0,
- (imageSize.height * self.zoomScale - boundsSize.height) / 2.0);
- }
-
// Disable scrolling initially until the first pinch to fix issues with swiping on an initally zoomed in photo
self.scrollEnabled = NO;
@@ -374,10 +360,6 @@
#pragma mark - Tap Detection
-- (void)handleSingleTap:(CGPoint)touchPoint {
- [_photoBrowser performSelector:@selector(toggleControls) withObject:nil afterDelay:0.2];
-}
-
- (void)handleDoubleTap:(CGPoint)touchPoint {
// Dont double tap to zoom if showing a video
@@ -410,8 +392,8 @@
}
// Image View
-- (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch {
- [self handleSingleTap:[touch locationInView:imageView]];
+- (void)imageView:(UIImageView *)imageView singleTapDetected:(UITouch *)touch {
+ [self view:imageView.window singleTapDetected:touch];
}
- (void)imageView:(UIImageView *)imageView doubleTapDetected:(UITouch *)touch {
[self handleDoubleTap:[touch locationInView:imageView]];
@@ -419,24 +401,33 @@
// Background View
- (void)view:(UIView *)view singleTapDetected:(UITouch *)touch {
- // Translate touch location to image view location
+ CGFloat touchX = [touch locationInView:view].x;
+ CGFloat width = view.frame.size.width;
+ if (touchX < width * 0.25 && touch.tapCount == 1) {
+ [_photoBrowser showPreviousPhotoAnimated:NO];
+ }
+ else if (touchX > width * 0.75 && touch.tapCount == 1) {
+ [_photoBrowser showNextPhotoAnimated:NO];
+ }
+ else if (touch.tapCount == 1) {
+ [_photoBrowser performSelector:@selector(toggleControls) withObject:nil afterDelay:0.2];
+ }
+}
+
+- (CGPoint)translateLocationOfTouch:(UITouch *)touch inView:(UIView *)view {
CGFloat touchX = [touch locationInView:view].x;
CGFloat touchY = [touch locationInView:view].y;
touchX *= 1/self.zoomScale;
touchY *= 1/self.zoomScale;
touchX += self.contentOffset.x;
touchY += self.contentOffset.y;
- [self handleSingleTap:CGPointMake(touchX, touchY)];
+ return CGPointMake(touchX, touchY);
}
+
- (void)view:(UIView *)view doubleTapDetected:(UITouch *)touch {
// Translate touch location to image view location
- CGFloat touchX = [touch locationInView:view].x;
- CGFloat touchY = [touch locationInView:view].y;
- touchX *= 1/self.zoomScale;
- touchY *= 1/self.zoomScale;
- touchX += self.contentOffset.x;
- touchY += self.contentOffset.y;
- [self handleDoubleTap:CGPointMake(touchX, touchY)];
+ CGPoint location = [self translateLocationOfTouch:touch inView:view];
+ [self handleDoubleTap:location];
}
@end