forked from androidx/androidx
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve interop touches by using UIScrollView-like strategy (#1440)
## Description In this approach `CMPGestureRecognizer` delays `touchesBegan` until explicitly failed, and is required to fail by `UIGestureRecognizer` of children views (aka interop views). Failure happens after the first touch started and no motion above scroll slop happens within 150ms. If this happens, intercepted touches are delivered to children views (and their gesture recognisers), Compose itself gets all tracked touches as cancelled and ignores them until the touch sequence ends (imposed by UIKit). This behavior is inspired by `UIScrollView` implementation. https://github.com/JetBrains/compose-multiplatform-core/assets/4167681/1245b986-1f11-4f02-a939-c069a7797e3a ### Fixes Improves behavior of touches in [certain scenarios](JetBrains/compose-multiplatform#4818) ## Testing This should be tested by QA ## Release Notes ### iOS - Features - Improvements in touches processing to detect if touches were meant to be delivered to interop views, or should be processed by Compose. --------- Co-authored-by: Ivan Matkov <ivan.matkov@jetbrains.com>
- Loading branch information
1 parent
97f7fbd
commit 174766b
Showing
5 changed files
with
495 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/platform/Constants.uikit.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2024 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package androidx.compose.ui.platform | ||
|
||
/** | ||
* iOS default value in scale-independent points for touch slop that recognizes as scroll/pan gesture. | ||
*/ | ||
internal const val CUPERTINO_TOUCH_SLOP = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.