@@ -43,7 +43,7 @@ public struct XYPad: View {
43
43
44
44
cx. fill ( ind, with: . color( foregroundColor) )
45
45
}
46
- } . padding ( indicatorSize. width * indicatorPadding)
46
+ } . padding ( indicatorSize. height * indicatorPadding)
47
47
}
48
48
}
49
49
}
@@ -53,12 +53,14 @@ extension XYPad {
53
53
y: Binding < Float > ,
54
54
backgroundColor: Color ,
55
55
foregroundColor: Color ,
56
- cornerRadius: CGFloat ) {
56
+ cornerRadius: CGFloat ,
57
+ indicatorSize: CGSize ) {
57
58
self . _x = x
58
59
self . _y = y
59
60
self . backgroundColor = backgroundColor
60
61
self . foregroundColor = foregroundColor
61
62
self . cornerRadius = cornerRadius
63
+ self . indicatorSize = indicatorSize
62
64
}
63
65
64
66
@@ -68,7 +70,8 @@ extension XYPad {
68
70
return . init( x: _x, y: _y,
69
71
backgroundColor: backgroundColor,
70
72
foregroundColor: foregroundColor,
71
- cornerRadius: cornerRadius)
73
+ cornerRadius: cornerRadius,
74
+ indicatorSize: indicatorSize)
72
75
}
73
76
74
77
/// Modifer to change the foreground color of the xy pad
@@ -77,7 +80,8 @@ extension XYPad {
77
80
return . init( x: _x, y: _y,
78
81
backgroundColor: backgroundColor,
79
82
foregroundColor: foregroundColor,
80
- cornerRadius: cornerRadius)
83
+ cornerRadius: cornerRadius,
84
+ indicatorSize: indicatorSize)
81
85
}
82
86
83
87
/// Modifer to change the corner radius of the xy pad and the indicator
@@ -86,6 +90,17 @@ extension XYPad {
86
90
return . init( x: _x, y: _y,
87
91
backgroundColor: backgroundColor,
88
92
foregroundColor: foregroundColor,
89
- cornerRadius: cornerRadius)
93
+ cornerRadius: cornerRadius,
94
+ indicatorSize: indicatorSize)
95
+ }
96
+
97
+ /// Modifer to change the size of the indicator
98
+ /// - Parameter indicatorSize: size of the indicator
99
+ public func indicatorSize( _ indicatorSize: CGSize ) -> XYPad {
100
+ return . init( x: _x, y: _y,
101
+ backgroundColor: backgroundColor,
102
+ foregroundColor: foregroundColor,
103
+ cornerRadius: cornerRadius,
104
+ indicatorSize: indicatorSize)
90
105
}
91
106
}
0 commit comments