mirror of
https://github.com/laosb/CropImage.git
synced 2025-04-30 15:41:08 +00:00
feat: Animation for targetSize change.
This commit is contained in:
parent
f34449d10a
commit
bbfe1e4636
2 changed files with 8 additions and 1 deletions
|
@ -151,6 +151,7 @@ public struct CropImageView<Controls: View>: View {
|
|||
RectHoleShape(size: targetSize)
|
||||
.fill(style: FillStyle(eoFill: true))
|
||||
.foregroundColor(.black.opacity(0.6))
|
||||
.animation(.default, value: targetSize)
|
||||
.allowsHitTesting(false)
|
||||
controls {
|
||||
do {
|
||||
|
|
|
@ -8,7 +8,13 @@
|
|||
import SwiftUI
|
||||
|
||||
struct RectHoleShape: Shape {
|
||||
let size: CGSize
|
||||
var size: CGSize
|
||||
|
||||
var animatableData: AnimatablePair<CGFloat, CGFloat> {
|
||||
get { .init(size.width, size.height) }
|
||||
set { size = .init(width: newValue.first, height: newValue.second) }
|
||||
}
|
||||
|
||||
func path(in rect: CGRect) -> Path {
|
||||
let path = CGMutablePath()
|
||||
path.move(to: rect.origin)
|
||||
|
|
Loading…
Add table
Reference in a new issue