/
CropViewConfig.swift
67 lines (50 loc) · 1.8 KB
/
CropViewConfig.swift
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
import UIKit
public struct CropViewConfig {
/**
This value is for how easy to drag crop box. The bigger, the easier.
*/
public var cropBoxHotAreaUnit: CGFloat = 32 {
didSet {
assert(cropBoxHotAreaUnit > 0)
}
}
public var cropShapeType: CropShapeType = .rect
public var cropBorderWidth: CGFloat = 0 {
didSet {
assert(cropBorderWidth > 0)
}
}
public var cropBorderColor: UIColor = .clear
/**
When backgroundColor is set, cropMaskVisualEffectType is automatically set to custom type
*/
public var backgroundColor: UIColor? {
didSet {
cropMaskVisualEffectType = .custom(color: backgroundColor!)
}
}
public var cropMaskVisualEffectType: CropMaskVisualEffectType = .blurDark
public var presetTransformationType: PresetTransformationType = .none
public var minimumZoomScale: CGFloat = 1 {
didSet {
assert(minimumZoomScale >= 1)
}
}
public var maximumZoomScale: CGFloat = 15
/**
Rotation Dial currently is tightly coupled with other parts of CropView, we see rotation dial as a part of CropView,
so we put dialConfig inside CropViewConfig
*/
public var dialConfig = DialConfig()
public var showRotationDial = true
public var padding: CGFloat = 14 {
didSet {
assert(padding >= 3, "padding is need to be at least 3 in order to show the whole crop box handles")
}
}
public var cropActivityIndicator: ActivityIndicatorProtocol?
public var cropActivityIndicatorSize = CGSize(width: 100, height: 100)
var minimumCropBoxSize: CGFloat = 42
public var disableCropBoxDeformation = false
public init() {}
}