@@ -36,6 +36,9 @@ extension ZYQuadRangleClipView {
36
36
37
37
open class ZYQuadRangleClipView : UIView {
38
38
39
+
40
+ open var magView : UIView ?
41
+
39
42
open var lineStrokeColor : UIColor ! = UIColor ( red: 72 / 255.0 , green: 34 / 255.0 , blue: 236 / 255 , alpha: 1 )
40
43
41
44
open var outCircleWidth : CGFloat = 30 , innerCircleWidth : CGFloat = 20
@@ -47,6 +50,11 @@ open class ZYQuadRangleClipView: UIView {
47
50
open var linePath = UIBezierPath ( )
48
51
open var magnifierglass : ZYMaginifierglass !
49
52
53
+ /// 剪切范围是否合法
54
+ open var isCropPathValid : Bool {
55
+ return self . isLinePathValidate
56
+ }
57
+
50
58
/// 剪切范围变化了
51
59
open var cropChange : ( ( ) -> Void ) ?
52
60
@@ -183,7 +191,26 @@ open class ZYQuadRangleClipView: UIView {
183
191
184
192
@objc func panGes( ges: UIPanGestureRecognizer ) {
185
193
var point = ges. location ( in: self )
186
- let imagpoin = ges. location ( in: self . superview)
194
+ var imagpoin = ges. location ( in: self . magView)
195
+ let convertRect = self . convert ( self . bounds, to: self . magView)
196
+ print ( " mag point= \( imagpoin) - converntframe = \( convertRect) " )
197
+
198
+ if imagpoin. x < convertRect. minX {
199
+ imagpoin. x = convertRect. minX
200
+ }
201
+
202
+ if imagpoin. x > convertRect. maxX {
203
+ imagpoin. x = convertRect. maxX
204
+ }
205
+
206
+ if imagpoin. y < convertRect. minY {
207
+ imagpoin. y = convertRect. minY
208
+ }
209
+
210
+ if imagpoin. y > convertRect. maxY {
211
+ imagpoin. y = convertRect. maxY
212
+ }
213
+
187
214
if point. x <= 0 {
188
215
point. x = 0
189
216
}
@@ -219,7 +246,8 @@ open class ZYQuadRangleClipView: UIView {
219
246
220
247
switch ges. state {
221
248
case . began:
222
- magnifierglass. magnifiedView = self . superview
249
+ magnifierglass. magnifiedView = self . magView
250
+ // magnifierglass.testView = self
223
251
magnifierglass. magnify ( at: imagpoin)
224
252
case . changed:
225
253
magnifierglass. magnify ( at: imagpoin)
0 commit comments