Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shima11 committed Apr 22, 2024
1 parent 4740ce4 commit 0188c9e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dev/Sources/Demo/Contents/DemoPreviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private final class PreviewViewWrapperViewController: UIViewController {

init(editingStack: EditingStack) {

self.previewView = ImagePreviewView(editingStack: editingStack)
self.previewView = ImagePreviewView(editingStack: editingStack, contentMode: .scaleAspectFill)
super.init(nibName: nil, bundle: nil)

}
Expand Down
2 changes: 1 addition & 1 deletion Dev/Sources/SwiftUIDemo/DemoCropView2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct DemoCropView2: View {
.clipped()
.background(Color.gray)

ViewHost(instantiated: ImagePreviewView(editingStack: editingStack))
ViewHost(instantiated: ImagePreviewView(editingStack: editingStack, contentMode: .scaleAspectFill))
.background(Color.black)
.cornerRadius(24, style: .continuous)
.padding(.init(top: 20, leading: 20, bottom: 20, trailing: 20))
Expand Down
2 changes: 1 addition & 1 deletion Dev/Sources/SwiftUIDemo/DemoMaskingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct DemoMaskingView: View {
var body: some View {
VStack {
ZStack {
ViewHost(instantiated: ImagePreviewView(editingStack: editingStack))
ViewHost(instantiated: ImagePreviewView(editingStack: editingStack, contentMode: .scaleAspectFill))
SwiftUIBlurryMaskingView(editingStack: editingStack)
.blushSize(brushSize)
.hideBackdropImageView(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public final class ClassicImageEditViewController: UIViewController {
public init(viewModel: ClassicImageEditViewModel) {
self.viewModel = viewModel
cropView = .init(editingStack: viewModel.editingStack, contentInset: .zero)
previewView = .init(editingStack: viewModel.editingStack)
previewView = .init(editingStack: viewModel.editingStack, contentMode: .scaleAspectFit)
maskingView = .init(editingStack: viewModel.editingStack)
super.init(nibName: nil, bundle: nil)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/BrightroomUI/Shared/Components/Crop/CropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ extension CropView {
func _zoom() {

scrollView.customZoom(
to: crop.zoomExtent(visibleSize: guideView.bounds.size),
to: crop.zoomExtent(),
guideSize: guideView.bounds.size,
adjustmentRotation: crop.aggregatedRotation.radians,
animated: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ public struct SwiftUICropView: UIViewControllerRepresentable {
uiViewController.bodyView.setStateHandler(stateHandler)
uiViewController.bodyView.setCroppingAspectRatio(_croppingAspectRatio)

_resetAction?.onCall = {
uiViewController.bodyView.resetCrop()
_resetAction?.onCall = { [weak uiViewController] in
uiViewController?.bodyView.resetCrop()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final class ImagePreviewView: PixelEditorCodeBasedView {

// MARK: - Initializers

public init(editingStack: EditingStack) {
public init(editingStack: EditingStack, contentMode: UIView.ContentMode) {
// FIXME: Loading State

self.editingStack = editingStack
Expand All @@ -69,7 +69,7 @@ public final class ImagePreviewView: PixelEditorCodeBasedView {
].forEach { imageView in
addSubview(imageView)
imageView.clipsToBounds = true
imageView.contentMode = .scaleAspectFit
imageView.contentMode = contentMode
imageView.isOpaque = false
imageView.frame = bounds
imageView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
Expand Down
2 changes: 1 addition & 1 deletion Sources/BrightroomUI/Shared/Utils/EditingCrop+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension EditingCrop {
return (min: minScale, max: .greatestFiniteMagnitude)
}

func zoomExtent(visibleSize: CGSize) -> CGRect {
func zoomExtent() -> CGRect {

let contentSize = scrollViewContentSize()
let cropExtent = cropExtent
Expand Down

0 comments on commit 0188c9e

Please sign in to comment.