Don't select a tool by default in image editor view.

pull/1/head
Matthew Chen 6 years ago
parent 8736db96af
commit 2b25d875bc

@ -11,21 +11,26 @@ public class ImageEditorView: UIView, ImageEditorModelDelegate {
private let model: ImageEditorModel private let model: ImageEditorModel
enum EditorMode: String { enum EditorMode: String {
case none
case brush case brush
case crop case crop
} }
private var editorMode = EditorMode.brush { private var editorMode = EditorMode.none {
didSet { didSet {
AssertIsOnMainThread() AssertIsOnMainThread()
switch editorMode { switch editorMode {
case .none:
editorGestureRecognizer?.isEnabled = false
case .brush: case .brush:
// Brush strokes can start and end (and return from) outside the view. // Brush strokes can start and end (and return from) outside the view.
editorGestureRecognizer?.shouldAllowOutsideView = true editorGestureRecognizer?.shouldAllowOutsideView = true
editorGestureRecognizer?.isEnabled = true
case .crop: case .crop:
// Crop gestures can start and end (and return from) outside the view. // Crop gestures can start and end (and return from) outside the view.
editorGestureRecognizer?.shouldAllowOutsideView = true editorGestureRecognizer?.shouldAllowOutsideView = true
editorGestureRecognizer?.isEnabled = true
} }
} }
} }
@ -209,6 +214,8 @@ public class ImageEditorView: UIView, ImageEditorModelDelegate {
AssertIsOnMainThread() AssertIsOnMainThread()
switch editorMode { switch editorMode {
case .none:
break
case .brush: case .brush:
handleBrushGesture(gestureRecognizer) handleBrushGesture(gestureRecognizer)
case .crop: case .crop:

Loading…
Cancel
Save