Returning Pointer for non-continuous gestures

Ask for help and post bugs.

Returning Pointer for non-continuous gestures

Postby thijsvn » Fri Aug 11, 2017 11:54 am

Hey,

First off awesome plugin!

That said I've encountered a problem. We're using you plugin for a project that has to run in iOS (touch) and WebGL (mouse), the issue
I'm having is that when subscribing to a one-off gesture like a Tap, When the callback occurs it doesn't return the pointer that was used to
formulate the gesture. Is there any way to make this information available? I'd need it to distinguish between 1 and 2 finger taps and Left
or Right mouse button clicked.

I hope my problem is clear and you're able to help.

Sincerely,
Thijs
thijsvn
 
Posts: 4
Joined: Thu May 12, 2016 5:57 pm

Re: Returning Pointer for non-continuous gestures

Postby tswalk » Wed Aug 16, 2017 7:13 am

do you mean something like this:

Code: Select all
        var _points = _tapGesture.ActivePointers;
        foreach(var point in _points)
        {
            if(point.Buttons == TouchScript.Pointers.Pointer.PointerButtonState.FirstButtonPressed)
            {
                //first button pressed (see documentation for explanation)
            }
        }


this could be done in the callback for the 'tapped' event to see if one of the pointers is the first button (left mouse button) or other pointer type... ?
User avatar
tswalk
 
Posts: 33
Joined: Sun Sep 20, 2015 6:37 am
Location: Texas, US

Re: Returning Pointer for non-continuous gestures

Postby thijsvn » Wed Aug 16, 2017 11:41 am

Hey tswalk,

Thanks for your reply. The code snippet you posted is almost exactly what i've tried so far. The problem is that _tapGesture.ActivePointers is empty.
I've found ActivePointers to be empty on all callbacks that signal the end of a Gesture. So for instance Transform_Ended.ActivePointers is also
empty. I'm unsure if this is a bug or by design, but either way i'm trying to find a way around it.
thijsvn
 
Posts: 4
Joined: Thu May 12, 2016 5:57 pm

Re: Returning Pointer for non-continuous gestures

Postby valyard » Wed Aug 30, 2017 1:17 pm

Unfortunately this is by design... probably not the best choice, I agree — the use case you mentioned is valid.

Another thing is that you can't have a reliable 2-finger tap because two fingers might be lift off in separate frames because computers are faster than humans.
I'd advise you to modify TapGesture to store the data you need or add a PressGesture and get the pointer from there.
valyard
Site Admin
 
Posts: 435
Joined: Mon Sep 08, 2014 11:57 pm

Re: Returning Pointer for non-continuous gestures

Postby thijsvn » Thu Aug 31, 2017 3:58 pm

This is what I feared.. Thanks for getting back to me. I've now edited the TapGesture to cache which pointer started the gesture and send it with
when it's recognized.

Cheers,
thijsvn
 
Posts: 4
Joined: Thu May 12, 2016 5:57 pm


Return to Help and Bugs

Who is online

Users browsing this forum: No registered users and 3 guests