You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -138,8 +138,9 @@ If you want to display `SwiftyCrop` inside a sheet, use `NavigationView` instead
138
138
SwiftyCrop supports two different mask shapes for cropping:
139
139
-`circle`
140
140
-`square`
141
+
-`rectangle`
141
142
142
-
This is only the shape of the mask the user will see when cropping the image. The resulting, cropped image will always be a square by default. You can override this using a configuration.
143
+
This is only the shape of the mask the user will see when cropping the image. The resulting, cropped image will always be a square by default when using `circle` or `square`. To get a circular cropped image, you can override this using a configuration.
143
144
144
145
You can also configure `SwiftyCropView` by passing a `SwiftyCropConfiguration`. A configuration has the following properties:
145
146
@@ -148,8 +149,9 @@ You can also configure `SwiftyCropView` by passing a `SwiftyCropConfiguration`.
148
149
|`maxMagnificationScale`|`CGFloat`: The maximum scale factor that the image can be magnified while cropping. Defaults to `4.0`. |
149
150
|`maskRadius`|`CGFloat`: The radius of the mask used for cropping. Defaults to `130`. A good way is to make it dependend on the screens size. |
150
151
|`cropImageCircular`|`Bool`: When using the cropping mask `circle`, whether the resulting image should also be masked as circle. Defaults to `false`. |
151
-
|`rotateImage`|`Bool`: Whether the image can be rotated when cropping using pinch gestures. Defaults to `true`. |
152
+
|`rotateImage`|`Bool`: Whether the image can be rotated when cropping using pinch gestures. Defaults to `false`. |
152
153
|`zoomSensitivity`|`CGFloat`: Zoom sensitivity when cropping. Increase to make zoom faster / less sensitive. Defaults to `1.0`. |
154
+
|`rectAspectRatio`|`CGFloat`: The aspect ratio to use when a rectangular mask shape is used. Defaults to `4:3`. |
153
155
154
156
Create a configuration like this:
155
157
```swift
@@ -158,7 +160,8 @@ let configuration = SwiftyCropConfiguration(
158
160
maskRadius: 130,
159
161
cropImageCircular: false,
160
162
rotateImage: true,
161
-
zoomSensitivity =1.0
163
+
zoomSensitivity =1.0,
164
+
rectAspectRatio =4/3
162
165
)
163
166
```
164
167
and use it like this:
@@ -185,6 +188,8 @@ Thanks to [@leoz](https://github.com/leoz) for adding the circular crop mode, th
185
188
186
189
Thanks to [@kevin-hv](https://github.com/kevin-hv) for adding the hungarian localization 🇭🇺
187
190
191
+
Thanks to [@Festanny](https://github.com/Festanny) for helping with the recangular cropping functionality 🎉
0 commit comments