Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SwiftUIBlurryMaskingView #228

Merged
merged 1 commit into from Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions Dev/Sources/SwiftUIDemo/DemoMaskingView.swift
@@ -1,4 +1,5 @@
import BrightroomEngine
import SwiftUISupport
import BrightroomUI
import SwiftUI

Expand All @@ -14,8 +15,12 @@ struct DemoMaskingView: View {

var body: some View {
VStack {
SwiftUIBlurryMaskingView(editingStack: editingStack)
.blushSize(brushSize)
ZStack {
ViewHost(instantiated: ImagePreviewView(editingStack: editingStack))
SwiftUIBlurryMaskingView(editingStack: editingStack)
.blushSize(brushSize)
.hideBackdropImageView(true)
}

HStack {
Button(action: {
Expand All @@ -34,6 +39,7 @@ struct DemoMaskingView: View {
Text("50")
})
}

}
}

Expand Down
Expand Up @@ -349,7 +349,7 @@ public final class ClassicImageEditViewController: UIViewController {
previewView.isHidden = true

maskingView.isHidden = true
maskingView.isblurryImageViewHidden = true
maskingView.isBlurryImageViewHidden = true

maskingView.isUserInteractionEnabled = false

Expand All @@ -361,7 +361,7 @@ public final class ClassicImageEditViewController: UIViewController {
cropView.isHidden = true
previewView.isHidden = false
maskingView.isHidden = false
maskingView.isblurryImageViewHidden = false
maskingView.isBlurryImageViewHidden = false

maskingView.isUserInteractionEnabled = true

Expand All @@ -373,7 +373,7 @@ public final class ClassicImageEditViewController: UIViewController {
cropView.isHidden = true
previewView.isHidden = false
maskingView.isHidden = true
maskingView.isblurryImageViewHidden = true
maskingView.isBlurryImageViewHidden = true

maskingView.isUserInteractionEnabled = false

Expand All @@ -386,7 +386,7 @@ public final class ClassicImageEditViewController: UIViewController {
previewView.isHidden = false
cropView.isHidden = true
maskingView.isHidden = false
maskingView.isblurryImageViewHidden = false
maskingView.isBlurryImageViewHidden = false

maskingView.isUserInteractionEnabled = false
}
Expand Down
Expand Up @@ -74,7 +74,7 @@ public final class BlurryMaskingView: PixelEditorCodeBasedView, UIScrollViewDele
}
}

public var isblurryImageViewHidden: Bool {
public var isBlurryImageViewHidden: Bool {
get {
blurryImageView.isHidden
}
Expand Down Expand Up @@ -285,6 +285,9 @@ public struct SwiftUIBlurryMaskingView: UIViewControllerRepresentable {

private var _brushSize: CanvasView.BrushSize?

private var _isBackdropImageViewHidden: Bool?
private var _isBlurryImageViewHidden: Bool?

public init(
editingStack: EditingStack
) {
Expand All @@ -305,14 +308,33 @@ public struct SwiftUIBlurryMaskingView: UIViewControllerRepresentable {
if let _brushSize {
uiViewController.bodyView.setBrushSize(_brushSize)
}
if let _isBackdropImageViewHidden {
uiViewController.bodyView.isBackdropImageViewHidden = _isBackdropImageViewHidden
}
if let _isBlurryImageViewHidden {
uiViewController.bodyView.isBlurryImageViewHidden = _isBlurryImageViewHidden
}
}

public func blushSize(_ brushSize: CanvasView.BrushSize?) -> Self {
public func blushSize(_ brushSize: CanvasView.BrushSize) -> Self {

var modified = self
modified._brushSize = brushSize
return modified
}

public func hideBackdropImageView(_ isBackdropImageViewHidden: Bool) -> Self {

var modified = self
modified._isBackdropImageViewHidden = isBackdropImageViewHidden
return modified
}

public func hideBlurryImageView(_ isBlurryImageViewHidden: Bool) -> Self {

var modified = self
modified._isBlurryImageViewHidden = isBlurryImageViewHidden
return modified
}

}