Skip to content

Commit ecd5c35

Browse files
committed
Adjust simultaneous recognition
1 parent a8e8b24 commit ecd5c35

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

Sources/GateEngine/UI/GestureRecognizers/PanGestureRecognizer.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ final public class PanGestureRecognizer: GestureRecognizer {
4141
self.surfaceTouches.removeAll(keepingCapacity: true)
4242
self.position1 = nil
4343
self.position2 = nil
44-
Log.info("PanGestureRecognizer invalidated.")
4544
}
4645

4746
public override func recognizesSimultaneously(with otherGestureRecognizer: some GestureRecognizer) -> Bool {
47+
if otherGestureRecognizer is PanGestureRecognizer {
48+
return true
49+
}
4850
if otherGestureRecognizer is PinchGestureRecognizer {
4951
return true
5052
}

Sources/GateEngine/UI/GestureRecognizers/PinchGestureRecognizer.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ final public class PinchGestureRecognizer: GestureRecognizer {
2424
self.surfaceTouches.removeAll(keepingCapacity: true)
2525
self.distance1 = nil
2626
self.distance2 = nil
27-
Log.info("PinchGestureRecognizer invalidated.")
2827
}
2928

3029
public override func recognizesSimultaneously(with otherGestureRecognizer: some GestureRecognizer) -> Bool {
30+
if otherGestureRecognizer is PinchGestureRecognizer {
31+
return true
32+
}
3133
if otherGestureRecognizer is PanGestureRecognizer {
3234
return true
3335
}

Sources/GateEngine/UI/GestureRecognizers/RotateGestureRecognizer.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ final public class RotateGestureRecognizer: GestureRecognizer {
2828
// self.surfaceTouches.removeAll(keepingCapacity: true)
2929
// self.distance1 = nil
3030
// self.distance2 = nil
31-
Log.info("RotateGestureRecognizer invalidated.")
3231
}
3332

3433
public override func recognizesSimultaneously(with otherGestureRecognizer: some GestureRecognizer) -> Bool {
34+
if otherGestureRecognizer is RotateGestureRecognizer {
35+
return true
36+
}
3537
if otherGestureRecognizer is PanGestureRecognizer {
3638
return true
3739
}

Sources/GateEngine/UI/GestureRecognizers/TapGestureRecognizer.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,27 @@
55
* http://stregasgate.com
66
*/
77

8+
/// Recognizes Touch and Click HID events
89
final public class TapGestureRecognizer: GestureRecognizer {
910
public var touchCount: Int = 1
1011
private var actions: [(_ position: Position2)->()] = []
11-
var distance1: Float? = nil
12-
var distance2: Float? = nil
1312

1413
public init(recognizedSources: Sources = .all, touchCount: Int = 1, recognized: @escaping (_ position: Position2)->()) {
1514
self.touchCount = touchCount
1615
self.actions = [recognized]
1716
super.init(recognizedSources: recognizedSources)
1817
}
19-
18+
2019
public override func invalidate() {
2120
super.invalidate()
2221
self.phase = .unrecognized
2322
self.touches.removeAll(keepingCapacity: true)
24-
self.distance1 = nil
25-
self.distance2 = nil
2623
self.startPositions.removeAll(keepingCapacity: true)
2724
self.downInside = false
28-
Log.info("TapGestureRecognizer invalidated.")
25+
}
26+
27+
public override func recognizesSimultaneously(with otherGestureRecognizer: some GestureRecognizer) -> Bool {
28+
return false
2929
}
3030

3131
var touches: Set<Touch> = [] {
@@ -38,8 +38,6 @@ final public class TapGestureRecognizer: GestureRecognizer {
3838
}
3939
}else{
4040
self.phase = .unrecognized
41-
distance1 = nil
42-
distance2 = nil
4341
}
4442
}
4543
}

0 commit comments

Comments
 (0)