mirror of
https://github.com/dscyrescotti/Memola.git
synced 2026-03-23 09:51:18 +01: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)
|
||||
|
||||
override func viewWillAppear() {
|
||||
super.viewWillAppear()
|
||||
resizeDocumentView()
|
||||
@@ -462,14 +461,12 @@ extension CanvasViewController {
|
||||
enablesDrawing = false
|
||||
enablesPhotoInsertion = true
|
||||
}
|
||||
#if os(macOS)
|
||||
#warning("TODO: implement for macos")
|
||||
#else
|
||||
scrollView.isScrollEnabled = enablesScrolling
|
||||
drawingView.isUserInteractionEnabled = enablesDrawing
|
||||
photoInsertGesture?.isEnabled = enablesPhotoInsertion
|
||||
enablesDrawing ? drawingView.enableUserInteraction() : drawingView.disableUserInteraction()
|
||||
#if os(iOS)
|
||||
scrollView.isScrollEnabled = enablesScrolling
|
||||
#endif
|
||||
enablesDrawing ? drawingView.enableUserInteraction() : drawingView.disableUserInteraction()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,14 +480,6 @@ extension CanvasViewController {
|
||||
#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) {
|
||||
drawingView.disableUserInteraction()
|
||||
renderer.setRedrawsGraphicRender()
|
||||
|
||||
@@ -21,6 +21,10 @@ final class DrawingView: Platform.View {
|
||||
private var lastDrawTime: CFTimeInterval = 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) {
|
||||
self.tool = tool
|
||||
self.canvas = canvas
|
||||
@@ -58,6 +62,10 @@ final class DrawingView: Platform.View {
|
||||
let point = CGPoint(x: pointInLeftBottomOrigin.x, y: bounds.height - pointInLeftBottomOrigin.y)
|
||||
touchEnded(at: point)
|
||||
}
|
||||
|
||||
override func hitTest(_ point: NSPoint) -> NSView? {
|
||||
isUserInteractionEnabled ? super.hitTest(point) : nil
|
||||
}
|
||||
#else
|
||||
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
||||
!canvas.hasValidStroke
|
||||
|
||||
Reference in New Issue
Block a user