mirror of
https://github.com/laosb/CropImage.git
synced 2025-05-24 10:21:09 +00:00
fix: Circular cut hole.
This commit is contained in:
parent
030ac8cbde
commit
c296f3e6e5
1 changed files with 15 additions and 2 deletions
|
@ -33,9 +33,19 @@ public struct DefaultCutHoleView: View {
|
||||||
.foregroundColor(maskColor)
|
.foregroundColor(maskColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
var stroke: some View {
|
@ViewBuilder
|
||||||
|
var strokeShape: some View {
|
||||||
|
if isCircular {
|
||||||
|
Circle()
|
||||||
|
.strokeBorder(style: .init(lineWidth: strokeWidth))
|
||||||
|
} else {
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.strokeBorder(style: .init(lineWidth: strokeWidth))
|
.strokeBorder(style: .init(lineWidth: strokeWidth))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var stroke: some View {
|
||||||
|
strokeShape
|
||||||
.frame(
|
.frame(
|
||||||
width: targetSize.width + strokeWidth * 2,
|
width: targetSize.width + strokeWidth * 2,
|
||||||
height: targetSize.height + strokeWidth * 2
|
height: targetSize.height + strokeWidth * 2
|
||||||
|
@ -54,5 +64,8 @@ public struct DefaultCutHoleView: View {
|
||||||
struct DefaultCutHoleView_Previews: PreviewProvider {
|
struct DefaultCutHoleView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
DefaultCutHoleView(targetSize: .init(width: 100, height: 100))
|
DefaultCutHoleView(targetSize: .init(width: 100, height: 100))
|
||||||
|
.previewDisplayName("Default")
|
||||||
|
DefaultCutHoleView(targetSize: .init(width: 100, height: 100), isCircular: true)
|
||||||
|
.previewDisplayName("Circular")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue