Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Fix for iOS touch recognition #39624

Merged
merged 1 commit into from
Jul 26, 2020

Conversation

naithar
Copy link
Contributor

@naithar naithar commented Jun 17, 2020

Fixes #39509

Custom UIGestureRecognizers gives more control over touch recognition and should be working stable enough so that new iOS release does not render fix useless or causes more bugs.
Using UIScrollView as base for Godot's GLView may result in getting unexpected and undocumented changes in Private API after release of new iOS version.
Usage of UIScrollViewDelayedTouchesBeganGestureRecognizer gives no result for simple UIView and it is also part of Private API, which could lead to application rejection.

Tested on both master and 3.2 branch.

@naithar naithar force-pushed the fix/ios-touch-events-master branch 2 times, most recently from 74e9578 to 4669d1f Compare June 17, 2020 16:59
@akien-mga akien-mga added bug cherrypick:3.x Considered for cherry-picking into a future 3.x release platform:ios topic:porting labels Jun 17, 2020
@akien-mga akien-mga added this to the 4.0 milestone Jun 17, 2020
@akien-mga akien-mga requested a review from a team June 17, 2020 17:21
@naithar naithar force-pushed the fix/ios-touch-events-master branch from 4669d1f to 3b4ac0c Compare June 18, 2020 14:13
@naithar naithar requested review from bojidar-bg, hpvb, neikeq, vnen and a team as code owners June 18, 2020 14:13
@naithar naithar force-pushed the fix/ios-touch-events-master branch from 3b4ac0c to 067b0e3 Compare June 18, 2020 14:17
@naithar
Copy link
Contributor Author

naithar commented Jun 18, 2020

Sorry, something happened while rebasing and GitHub added a review request on it's own, and it seems I can't remove request =(

@timoschwarzer
Copy link
Contributor

timoschwarzer commented Jul 10, 2020

I cherry-picked this commit onto 3.2.2-stable and unfortunately it introduces problems with dragging. It is easily reproducible with an HSlider. It always starts dragging only after a few hundred milliseconds after I begin to drag the slider. This applies not only to Sliders but to all touch input events, which makes drawing apps impossible.

Reverting this commit fixes the regression.

@naithar
Copy link
Contributor Author

naithar commented Jul 11, 2020

Using UIScrollView as base class for GLView gives the same result, so switching to it would not give any benefit.

The point of delaying touches, by the same amount used by UIScrollView, is to allow click event to work correctly. The problem is that on iOS devices, probably since iOS7 release, touchesMoved:withEvent: happens almost immediately after touchesBegan:withEvent, breaking click events for any Godot's control, that handles drag or scroll.

@naithar
Copy link
Contributor Author

naithar commented Jul 11, 2020

@timoschwarzer can you check latest changes? I've checked them on iPad, plus on iPhone 6 and XS and it seems like a scrolling issue went away as well as saving the fix.

@timoschwarzer
Copy link
Contributor

@naithar I will, thank you for the fast response! :)

@timoschwarzer
Copy link
Contributor

@naithar the new patch works just fine, I didn't find any regressions. Thank you very much! :)

@akien-mga akien-mga requested a review from bruvzg July 14, 2020 08:09
@naithar naithar force-pushed the fix/ios-touch-events-master branch from a4d656a to bec048e Compare July 14, 2020 22:42
@naithar
Copy link
Contributor Author

naithar commented Jul 15, 2020

I've rebased and made some additional changes, but they don't seem to be present in PR for some reason: naithar@52aef81

@naithar naithar force-pushed the fix/ios-touch-events-master branch 6 times, most recently from ae7f6c5 to 52aef81 Compare July 15, 2020 17:14
@timoschwarzer
Copy link
Contributor

Hmm, for me it shows that this PR is on 52aef81...

@naithar
Copy link
Contributor Author

naithar commented Jul 16, 2020

Yeah, seems like it got fixed by itself :)

This gesture recognizer will prevent GodotView from processing unwanted gestures.
Emulates UIScrollView behavior.
Fires delayed touches on significant movement.
@naithar naithar force-pushed the fix/ios-touch-events-master branch from 52aef81 to e6d7e01 Compare July 26, 2020 13:07
@naithar naithar changed the title Fix for iOS touch recognition [4.0] Fix for iOS touch recognition Jul 26, 2020
@akien-mga akien-mga merged commit df6f867 into godotengine:master Jul 26, 2020
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jul 26, 2020
@naithar naithar deleted the fix/ios-touch-events-master branch July 27, 2020 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bbcode in richtextlabel can not go to url on iOS
3 participants