mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Fix for liquid swipe
This commit is contained in:
parent
496ef399d1
commit
5c0f812f0c
@ -11,7 +11,7 @@ import AppKit
|
||||
/// You could create your own view extended from MacawView with predefined scene.
|
||||
///
|
||||
|
||||
open class MacawView: MView {
|
||||
open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
|
||||
internal var drawingView = DrawingView()
|
||||
|
||||
@ -80,6 +80,7 @@ open class MacawView: MView {
|
||||
self.renderer = RenderUtils.createNodeRenderer(node, view: drawingView)
|
||||
|
||||
zoom.initialize(view: self, onChange: onZoomChange)
|
||||
initializeView()
|
||||
}
|
||||
|
||||
public convenience init(node: Node, frame: CGRect) {
|
||||
@ -93,6 +94,7 @@ open class MacawView: MView {
|
||||
super.init(frame: frame)
|
||||
|
||||
zoom.initialize(view: self, onChange: onZoomChange)
|
||||
initializeView()
|
||||
}
|
||||
|
||||
private func onZoomChange(t: Transform) {
|
||||
@ -101,12 +103,6 @@ open class MacawView: MView {
|
||||
}
|
||||
}
|
||||
|
||||
open override func didMoveToSuperview() {
|
||||
super.didMoveToSuperview()
|
||||
|
||||
initializeView()
|
||||
}
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
@ -136,11 +132,11 @@ open class MacawView: MView {
|
||||
let rotationRecognizer = MRotationGestureRecognizer(target: drawingView, action: #selector(DrawingView.handleRotation))
|
||||
let pinchRecognizer = MPinchGestureRecognizer(target: drawingView, action: #selector(DrawingView.handlePinch))
|
||||
|
||||
tapRecognizer.delegate = drawingView
|
||||
longTapRecognizer.delegate = drawingView
|
||||
panRecognizer.delegate = drawingView
|
||||
rotationRecognizer.delegate = drawingView
|
||||
pinchRecognizer.delegate = drawingView
|
||||
tapRecognizer.delegate = self
|
||||
longTapRecognizer.delegate = self
|
||||
panRecognizer.delegate = self
|
||||
rotationRecognizer.delegate = self
|
||||
pinchRecognizer.delegate = self
|
||||
|
||||
tapRecognizer.cancelsTouchesInView = false
|
||||
longTapRecognizer.cancelsTouchesInView = false
|
||||
@ -191,9 +187,19 @@ open class MacawView: MView {
|
||||
return MTouchEvent(x: Double(location.x), y: Double(location.y), id: id)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - MGestureRecognizerDelegate
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: MGestureRecognizer, shouldReceive touch: MTouch) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
internal class DrawingView: MView, MGestureRecognizerDelegate {
|
||||
public func gestureRecognizer(_ gestureRecognizer: MGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: MGestureRecognizer) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
internal class DrawingView: MView {
|
||||
|
||||
/// Scene root node
|
||||
open var node: Node = Group() {
|
||||
@ -659,16 +665,6 @@ internal class DrawingView: MView, MGestureRecognizerDelegate {
|
||||
recognizersMap.removeValue(forKey: recognizer)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - MGestureRecognizerDelegate
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: MGestureRecognizer, shouldReceive touch: MTouch) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
public func gestureRecognizer(_ gestureRecognizer: MGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: MGestureRecognizer) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
class LayoutHelper {
|
||||
|
Loading…
Reference in New Issue
Block a user