mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-07-09 14:25:18 +02:00
feat: disable user interaction for drawing view when hand tool is selected
This commit is contained in:
@@ -48,7 +48,6 @@ final class CanvasViewController: Platform.ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
|
|
||||||
override func viewWillAppear() {
|
override func viewWillAppear() {
|
||||||
super.viewWillAppear()
|
super.viewWillAppear()
|
||||||
resizeDocumentView()
|
resizeDocumentView()
|
||||||
@@ -462,14 +461,12 @@ extension CanvasViewController {
|
|||||||
enablesDrawing = false
|
enablesDrawing = false
|
||||||
enablesPhotoInsertion = true
|
enablesPhotoInsertion = true
|
||||||
}
|
}
|
||||||
#if os(macOS)
|
|
||||||
#warning("TODO: implement for macos")
|
|
||||||
#else
|
|
||||||
scrollView.isScrollEnabled = enablesScrolling
|
|
||||||
drawingView.isUserInteractionEnabled = enablesDrawing
|
drawingView.isUserInteractionEnabled = enablesDrawing
|
||||||
photoInsertGesture?.isEnabled = enablesPhotoInsertion
|
photoInsertGesture?.isEnabled = enablesPhotoInsertion
|
||||||
enablesDrawing ? drawingView.enableUserInteraction() : drawingView.disableUserInteraction()
|
#if os(iOS)
|
||||||
|
scrollView.isScrollEnabled = enablesScrolling
|
||||||
#endif
|
#endif
|
||||||
|
enablesDrawing ? drawingView.enableUserInteraction() : drawingView.disableUserInteraction()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,14 +480,6 @@ extension CanvasViewController {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private func lockModeChanged(_ state: Bool) {
|
|
||||||
#if os(macOS)
|
|
||||||
#warning("TODO: implement for macos")
|
|
||||||
#else
|
|
||||||
scrollView.pinchGestureRecognizer?.isEnabled = !state
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
private func gridModeChanged(_ mode: GridMode) {
|
private func gridModeChanged(_ mode: GridMode) {
|
||||||
drawingView.disableUserInteraction()
|
drawingView.disableUserInteraction()
|
||||||
renderer.setRedrawsGraphicRender()
|
renderer.setRedrawsGraphicRender()
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ final class DrawingView: Platform.View {
|
|||||||
private var lastDrawTime: CFTimeInterval = 0
|
private var lastDrawTime: CFTimeInterval = 0
|
||||||
private let minDrawInterval: CFTimeInterval = 1.0 / 60.0
|
private let minDrawInterval: CFTimeInterval = 1.0 / 60.0
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
var isUserInteractionEnabled: Bool = true
|
||||||
|
#endif
|
||||||
|
|
||||||
required init(tool: Tool, canvas: Canvas, history: History) {
|
required init(tool: Tool, canvas: Canvas, history: History) {
|
||||||
self.tool = tool
|
self.tool = tool
|
||||||
self.canvas = canvas
|
self.canvas = canvas
|
||||||
@@ -58,6 +62,10 @@ final class DrawingView: Platform.View {
|
|||||||
let point = CGPoint(x: pointInLeftBottomOrigin.x, y: bounds.height - pointInLeftBottomOrigin.y)
|
let point = CGPoint(x: pointInLeftBottomOrigin.x, y: bounds.height - pointInLeftBottomOrigin.y)
|
||||||
touchEnded(at: point)
|
touchEnded(at: point)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func hitTest(_ point: NSPoint) -> NSView? {
|
||||||
|
isUserInteractionEnabled ? super.hitTest(point) : nil
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||||
!canvas.hasValidStroke
|
!canvas.hasValidStroke
|
||||||
|
|||||||
Reference in New Issue
Block a user