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

Investigate/Improve TouchEvent support #129

Open
JoshMarler opened this issue Nov 6, 2020 · 1 comment
Open

Investigate/Improve TouchEvent support #129

JoshMarler opened this issue Nov 6, 2020 · 1 comment
Milestone

Comments

@JoshMarler
Copy link
Owner

We are currently doing some work to improve blueprint's SyntheticEvent implementation. MouseEvent is gaining adoption of properties like target, relatedTarget, shitKey etc. It could be very useful to provide a TouchEvent for some applications.

This should match the spec here as close as possible: https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent

Ideally we would provide the following set of events: onTouchCancel onTouchEnd onTouchMove onTouchStart. See: https://reactjs.org/docs/events.html

As per this forum post JUCE has a MultiTouch example we could leverage:

https://forum.juce.com/t/how-to-do-ios-style-multitouch-handling/23936

It may be that we need to provide some mechanism to opt into this behaviour as the C++ side of generating TouchEvents is sure to incur some level of overhead.

@rafou
Copy link

rafou commented Nov 25, 2020

Hey @JoshMarler @nick-thompson ! First of all let me tell you how nice this project looks ! It's amazing what you have achieved already and I'm looking forward for the first release.

@JoshMarler concerning this feature, I gave it a shot and got pretty nice results on a real iPad (so multi touch surface) with 3 fingers and on the iPad Simulator in XCode where you are bound to 2 fingers. I managed to pull out an example mimicking the behavior of the example in the spec of the TouchEvent, by drawing on a CanvasView with multitouch. Here is a shot of the results: https://www.youtube.com/watch?v=V62-N2PH4eY

I have added also a "click" event on the Slider through Touch Event (for usage on an iPad) for example.

With the way JUCE handles the clicks/touches (not simultaneously but one after another even on the iPad simulator where the double touch occurs at the exact same moment), I didn't find a proper way to "bufferize" the juce mouse events to be able to generate multiple Touch object inside the changedTouches property of the TouchEvent. That's the closest I could get to the the spec you sent.

For now, I have handled onTouchStart, onTouchMove and onTouchEnd.

I'm really not familiar with C++ (I'm a Python dev) and JUCE var types (Array, Variant etc...) as I'm still discovering the project so feel free to comment and don't hesitate to tell me I've wrote some horrible code (I know that's probably the case)! Would you mind having a look at the PR please (here) ?

@nick-thompson nick-thompson added this to the v1.0 milestone Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants