diff --git a/Dev/Sources/SwiftUIDemo/DemoCropView2.swift b/Dev/Sources/SwiftUIDemo/DemoCropView2.swift index 535d1c59..1bff43f9 100644 --- a/Dev/Sources/SwiftUIDemo/DemoCropView2.swift +++ b/Dev/Sources/SwiftUIDemo/DemoCropView2.swift @@ -80,13 +80,11 @@ struct DemoCropView2: View { HStack { Slider(value: $angle.degrees, in: -45.0...45.0, step: 1) - .disabled(isDragging) Button(action: { baselineAngle -= .degrees(90) }, label: { Text("Rotate") }) - .disabled(isDragging) } .disabled(isDragging) .padding(24) diff --git a/Sources/BrightroomUI/Shared/Components/Crop/CropView.swift b/Sources/BrightroomUI/Shared/Components/Crop/CropView.swift index 070e3e16..f26d1102 100644 --- a/Sources/BrightroomUI/Shared/Components/Crop/CropView.swift +++ b/Sources/BrightroomUI/Shared/Components/Crop/CropView.swift @@ -275,17 +275,6 @@ public final class CropView: UIView, UIScrollViewDelegate { guideView.willChange = { [weak self] in guard let self = self else { return } self.willChangeGuideView() - store.commit { - $0.adjustmentKind = .guide - } - } - - guideView.updating = { [weak self] in - guard let self else { return } - guard let currentProposedCrop = store.state.proposedCrop else { - return - } - // updateScrollViewInset(crop: currentProposedCrop) } guideView.didChange = { [weak self] in diff --git a/Sources/BrightroomUI/Shared/Components/Crop/SwiftUICropView.swift b/Sources/BrightroomUI/Shared/Components/Crop/SwiftUICropView.swift index 4c938005..7577a53a 100644 --- a/Sources/BrightroomUI/Shared/Components/Crop/SwiftUICropView.swift +++ b/Sources/BrightroomUI/Shared/Components/Crop/SwiftUICropView.swift @@ -81,11 +81,13 @@ public struct SwiftUICropView: UIViewControllerRepresentable { private let stateHandler: @MainActor (Verge.Changes) -> Void private let isGuideInteractionEnabled: Bool + private let isAutoApplyEditingStackEnabled: Bool private let contentInset: UIEdgeInsets? public init( editingStack: EditingStack, isGuideInteractionEnabled: Bool = true, + isAutoApplyEditingStackEnabled: Bool = false, contentInset: UIEdgeInsets? = nil, @ViewBuilder cropInsideOverlay: @escaping (CropView.State.AdjustmentKind?) -> InsideOverlay, @ViewBuilder cropOutsideOverlay: @escaping (CropView.State.AdjustmentKind?) -> OutsideOverlay, @@ -93,6 +95,7 @@ public struct SwiftUICropView: UIViewControllerRepresentable { ) { self.editingStack = editingStack self.isGuideInteractionEnabled = isGuideInteractionEnabled + self.isAutoApplyEditingStackEnabled = isAutoApplyEditingStackEnabled self.contentInset = contentInset self.cropInsideOverlay = { AnyView(cropInsideOverlay($0)) } self.cropOutsideOverlay = { AnyView(cropOutsideOverlay($0)) } @@ -102,6 +105,7 @@ public struct SwiftUICropView: UIViewControllerRepresentable { public init( editingStack: EditingStack, isGuideInteractionEnabled: Bool = true, + isAutoApplyEditingStackEnabled: Bool = false, contentInset: UIEdgeInsets? = nil, stateHandler: @escaping @MainActor (Verge.Changes) -> Void = { _ in } ) { @@ -109,6 +113,7 @@ public struct SwiftUICropView: UIViewControllerRepresentable { self.cropOutsideOverlay = nil self.editingStack = editingStack self.isGuideInteractionEnabled = isGuideInteractionEnabled + self.isAutoApplyEditingStackEnabled = isAutoApplyEditingStackEnabled self.contentInset = contentInset self.stateHandler = stateHandler } @@ -122,7 +127,7 @@ public struct SwiftUICropView: UIViewControllerRepresentable { view = .init(editingStack: editingStack) } - view.isAutoApplyEditingStackEnabled = true + view.isAutoApplyEditingStackEnabled = isAutoApplyEditingStackEnabled view.isGuideInteractionEnabled = isGuideInteractionEnabled if let cropInsideOverlay {