mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Hide controls during stroke.
This commit is contained in:
parent
c77835926d
commit
9e636b0fc9
1 changed files with 21 additions and 3 deletions
|
@ -84,11 +84,18 @@ public class ImageEditorBrushViewController: OWSViewController {
|
|||
self.view.layoutSubviews()
|
||||
}
|
||||
|
||||
public func updateNavigationBar() {
|
||||
private func updateNavigationBar() {
|
||||
// Hide controls during stroke.
|
||||
let hasStroke = currentStroke != nil
|
||||
guard !hasStroke else {
|
||||
updateNavigationBar(navigationBarItems: [])
|
||||
return
|
||||
}
|
||||
|
||||
let undoButton = navigationBarButton(imageName: "image_editor_undo",
|
||||
selector: #selector(didTapUndo(sender:)))
|
||||
let doneButton = navigationBarButton(imageName: "image_editor_checkmark_full",
|
||||
selector: #selector(didTapDone(sender:)))
|
||||
selector: #selector(didTapDone(sender:)))
|
||||
|
||||
// Prevent users from undo any changes made before entering the view.
|
||||
let canUndo = model.canUndo() && firstUndoOperationId != model.currentUndoOperationId()
|
||||
|
@ -101,6 +108,12 @@ public class ImageEditorBrushViewController: OWSViewController {
|
|||
updateNavigationBar(navigationBarItems: navigationBarItems)
|
||||
}
|
||||
|
||||
private func updateControls() {
|
||||
// Hide controls during stroke.
|
||||
let hasStroke = currentStroke != nil
|
||||
paletteView.isHidden = hasStroke
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
@objc func didTapUndo(sender: UIButton) {
|
||||
|
@ -129,7 +142,12 @@ public class ImageEditorBrushViewController: OWSViewController {
|
|||
// MARK: - Brush
|
||||
|
||||
// These properties are non-empty while drawing a stroke.
|
||||
private var currentStroke: ImageEditorStrokeItem?
|
||||
private var currentStroke: ImageEditorStrokeItem? {
|
||||
didSet {
|
||||
updateControls()
|
||||
updateNavigationBar()
|
||||
}
|
||||
}
|
||||
private var currentStrokeSamples = [ImageEditorStrokeItem.StrokeSample]()
|
||||
|
||||
@objc
|
||||
|
|
Loading…
Reference in a new issue