mirror of
https://github.com/exyte/Macaw.git
synced 2024-11-04 00:39:57 +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.
|
/// 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()
|
internal var drawingView = DrawingView()
|
||||||
|
|
||||||
@ -80,6 +80,7 @@ open class MacawView: MView {
|
|||||||
self.renderer = RenderUtils.createNodeRenderer(node, view: drawingView)
|
self.renderer = RenderUtils.createNodeRenderer(node, view: drawingView)
|
||||||
|
|
||||||
zoom.initialize(view: self, onChange: onZoomChange)
|
zoom.initialize(view: self, onChange: onZoomChange)
|
||||||
|
initializeView()
|
||||||
}
|
}
|
||||||
|
|
||||||
public convenience init(node: Node, frame: CGRect) {
|
public convenience init(node: Node, frame: CGRect) {
|
||||||
@ -93,6 +94,7 @@ open class MacawView: MView {
|
|||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
zoom.initialize(view: self, onChange: onZoomChange)
|
zoom.initialize(view: self, onChange: onZoomChange)
|
||||||
|
initializeView()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func onZoomChange(t: Transform) {
|
private func onZoomChange(t: Transform) {
|
||||||
@ -101,12 +103,6 @@ open class MacawView: MView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func didMoveToSuperview() {
|
|
||||||
super.didMoveToSuperview()
|
|
||||||
|
|
||||||
initializeView()
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
@ -136,11 +132,11 @@ open class MacawView: MView {
|
|||||||
let rotationRecognizer = MRotationGestureRecognizer(target: drawingView, action: #selector(DrawingView.handleRotation))
|
let rotationRecognizer = MRotationGestureRecognizer(target: drawingView, action: #selector(DrawingView.handleRotation))
|
||||||
let pinchRecognizer = MPinchGestureRecognizer(target: drawingView, action: #selector(DrawingView.handlePinch))
|
let pinchRecognizer = MPinchGestureRecognizer(target: drawingView, action: #selector(DrawingView.handlePinch))
|
||||||
|
|
||||||
tapRecognizer.delegate = drawingView
|
tapRecognizer.delegate = self
|
||||||
longTapRecognizer.delegate = drawingView
|
longTapRecognizer.delegate = self
|
||||||
panRecognizer.delegate = drawingView
|
panRecognizer.delegate = self
|
||||||
rotationRecognizer.delegate = drawingView
|
rotationRecognizer.delegate = self
|
||||||
pinchRecognizer.delegate = drawingView
|
pinchRecognizer.delegate = self
|
||||||
|
|
||||||
tapRecognizer.cancelsTouchesInView = false
|
tapRecognizer.cancelsTouchesInView = false
|
||||||
longTapRecognizer.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)
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
public func gestureRecognizer(_ gestureRecognizer: MGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: MGestureRecognizer) -> Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class DrawingView: MView, MGestureRecognizerDelegate {
|
internal class DrawingView: MView {
|
||||||
|
|
||||||
/// Scene root node
|
/// Scene root node
|
||||||
open var node: Node = Group() {
|
open var node: Node = Group() {
|
||||||
@ -659,16 +665,6 @@ internal class DrawingView: MView, MGestureRecognizerDelegate {
|
|||||||
recognizersMap.removeValue(forKey: recognizer)
|
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 {
|
class LayoutHelper {
|
||||||
|
Loading…
Reference in New Issue
Block a user