Merge pull request #78083 from m4gr3d/fix_multitouch_detection_spatial_viewport_main

Fix spatial viewport multitouch detection support
This commit is contained in:
Fredia Huya-Kouadio 2023-06-11 18:08:59 -07:00 committed by GitHub
commit dcd31a25b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -231,7 +231,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
val x = terminusEvent.x
val y = terminusEvent.y
if (terminusEvent.pointerCount >= 2 && panningAndScalingEnabled && !pointerCaptureInProgress) {
if (terminusEvent.pointerCount >= 2 && panningAndScalingEnabled && !pointerCaptureInProgress && !dragInProgress) {
GodotLib.pan(x, y, distanceX / 5f, distanceY / 5f)
} else if (!scaleInProgress){
dragInProgress = true
@ -241,7 +241,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
}
override fun onScale(detector: ScaleGestureDetector): Boolean {
if (!panningAndScalingEnabled || pointerCaptureInProgress) {
if (!panningAndScalingEnabled || pointerCaptureInProgress || dragInProgress) {
return false
}
@ -256,7 +256,7 @@ internal class GodotGestureHandler : SimpleOnGestureListener(), OnScaleGestureLi
}
override fun onScaleBegin(detector: ScaleGestureDetector): Boolean {
if (!panningAndScalingEnabled || pointerCaptureInProgress) {
if (!panningAndScalingEnabled || pointerCaptureInProgress || dragInProgress) {
return false
}
scaleInProgress = true