|
|
@ -84,11 +84,18 @@ public class ImageEditorBrushViewController: OWSViewController {
|
|
|
|
self.view.layoutSubviews()
|
|
|
|
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",
|
|
|
|
let undoButton = navigationBarButton(imageName: "image_editor_undo",
|
|
|
|
selector: #selector(didTapUndo(sender:)))
|
|
|
|
selector: #selector(didTapUndo(sender:)))
|
|
|
|
let doneButton = navigationBarButton(imageName: "image_editor_checkmark_full",
|
|
|
|
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.
|
|
|
|
// Prevent users from undo any changes made before entering the view.
|
|
|
|
let canUndo = model.canUndo() && firstUndoOperationId != model.currentUndoOperationId()
|
|
|
|
let canUndo = model.canUndo() && firstUndoOperationId != model.currentUndoOperationId()
|
|
|
@ -101,6 +108,12 @@ public class ImageEditorBrushViewController: OWSViewController {
|
|
|
|
updateNavigationBar(navigationBarItems: navigationBarItems)
|
|
|
|
updateNavigationBar(navigationBarItems: navigationBarItems)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func updateControls() {
|
|
|
|
|
|
|
|
// Hide controls during stroke.
|
|
|
|
|
|
|
|
let hasStroke = currentStroke != nil
|
|
|
|
|
|
|
|
paletteView.isHidden = hasStroke
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: - Actions
|
|
|
|
// MARK: - Actions
|
|
|
|
|
|
|
|
|
|
|
|
@objc func didTapUndo(sender: UIButton) {
|
|
|
|
@objc func didTapUndo(sender: UIButton) {
|
|
|
@ -129,7 +142,12 @@ public class ImageEditorBrushViewController: OWSViewController {
|
|
|
|
// MARK: - Brush
|
|
|
|
// MARK: - Brush
|
|
|
|
|
|
|
|
|
|
|
|
// These properties are non-empty while drawing a stroke.
|
|
|
|
// 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]()
|
|
|
|
private var currentStrokeSamples = [ImageEditorStrokeItem.StrokeSample]()
|
|
|
|
|
|
|
|
|
|
|
|
@objc
|
|
|
|
@objc
|
|
|
|