Improve color continuity in the image editor.

pull/2/head
Matthew Chen 7 years ago
parent 93cb0e3a10
commit 3d96cd488e

@ -6,7 +6,7 @@ import UIKit
@objc @objc
public protocol ImageEditorBrushViewControllerDelegate: class { public protocol ImageEditorBrushViewControllerDelegate: class {
func brushDidComplete() func brushDidComplete(currentColor: ImageEditorColor)
} }
// MARK: - // MARK: -
@ -121,7 +121,7 @@ public class ImageEditorBrushViewController: OWSViewController {
} }
private func completeAndDismiss() { private func completeAndDismiss() {
self.delegate?.brushDidComplete() self.delegate?.brushDidComplete(currentColor: paletteView.selectedValue)
self.dismiss(animated: false) { self.dismiss(animated: false) {
// Do nothing. // Do nothing.

@ -24,7 +24,8 @@ public class ImageEditorView: UIView {
private let canvasView: ImageEditorCanvasView private let canvasView: ImageEditorCanvasView
// TODO: We could hang this on the model or make this static. // TODO: We could hang this on the model or make this static
// if we wanted more color continuity.
private var currentColor = ImageEditorColor.defaultColor() private var currentColor = ImageEditorColor.defaultColor()
@objc @objc
@ -444,7 +445,8 @@ public class ImageEditorView: UIView {
let cropTool = ImageEditorCropViewController(delegate: self, model: model, srcImage: srcImage, previewImage: previewImage) let cropTool = ImageEditorCropViewController(delegate: self, model: model, srcImage: srcImage, previewImage: previewImage)
self.delegate?.imageEditor(presentFullScreenView: cropTool, self.delegate?.imageEditor(presentFullScreenView: cropTool,
isTransparent: false) isTransparent: false)
}} }
}
// MARK: - // MARK: -
@ -498,6 +500,8 @@ extension ImageEditorView: ImageEditorTextViewControllerDelegate {
} else { } else {
model.append(item: newItem) model.append(item: newItem)
} }
self.currentColor = color
} }
public func textEditDidCancel() { public func textEditDidCancel() {
@ -520,6 +524,7 @@ extension ImageEditorView: ImageEditorCropViewControllerDelegate {
// MARK: - // MARK: -
extension ImageEditorView: ImageEditorBrushViewControllerDelegate { extension ImageEditorView: ImageEditorBrushViewControllerDelegate {
public func brushDidComplete() { public func brushDidComplete(currentColor: ImageEditorColor) {
self.currentColor = currentColor
} }
} }

Loading…
Cancel
Save