Skip to content

Commit

Permalink
Disable Animation in CropView (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Mar 29, 2024
1 parent 1dcf0b8 commit ca2935b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Sources/BrightroomUI/Shared/Components/Crop/CropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public final class CropView: UIView, UIScrollViewDelegate {
}
}

public var areAnimationsEnabled: Bool = true

public var isImageViewHidden: Bool {
get {
imagePlatterView.imageView.isHidden
Expand Down Expand Up @@ -332,7 +334,7 @@ public final class CropView: UIView, UIScrollViewDelegate {
editingStack.start()

binding: do {
store.sinkState(queue: .mainIsolated()) { [weak self] state in
store.sinkState(queue: .mainIsolated()) { [weak self, areAnimationsEnabled] state in

guard let self = self else { return }

Expand Down Expand Up @@ -379,7 +381,7 @@ public final class CropView: UIView, UIScrollViewDelegate {
self.updateScrollContainerView(
by: crop,
preferredAspectRatio: state.preferredAspectRatio,
animated: state.previous?.proposedCrop != nil /* whether first time load */,
animated: areAnimationsEnabled && state.previous?.proposedCrop != nil /* whether first time load */,
animatesRotation: state.hasChanges(\.proposedCrop?.rotation)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final class BlurryMaskingView: PixelEditorCodeBasedView, UIScrollViewDele
}
}

let backingView: CropView
private let backingView: CropView

private let containerView = ContainerView()

Expand Down Expand Up @@ -115,6 +115,7 @@ public final class BlurryMaskingView: PixelEditorCodeBasedView, UIScrollViewDele
editingStack: editingStack,
contentInset: .zero
)
self.backingView.areAnimationsEnabled = false
self.backingView.accessibilityIdentifier = "BlurryMasking"

store = .init(
Expand Down

0 comments on commit ca2935b

Please sign in to comment.