prevent Polymer pointer-gestures from happening while one has already started depending on gesture

StackOverflow https://stackoverflow.com/questions/23556066

  •  18-07-2023
  •  | 
  •  

Question

I'm playing with polymer's pointer-gestures and I love them.

However, flick, pinch, and track are interfering with each other. Meaning when one is happening, another happens before the first one can be identified by the .addEventListener()

I would like track to prevail over all, then pinch, then flick.

So if a track is happening, let it happen. If a pinch is happening let it happen unless a track started or was happening before it. If a flick is happening let it happen as long as a neither a track nor pinch started or was happening before it.

What is the proper way to do this? I am willing to edit the gestures' .js files. Since it is a polyfill, won't it rely on my polyfill. Or will the official, eventual native implementation overwrite it. Or is pointer-events only being officially implemented and not pointer-gestures?

How I would think of doing this is setting a boolean to false when a track happens, then if a pinch happens and that boolean is false nothing happens due to the pinch. If a pinch happens set another boolean to false and if a flick happens and only if both booleans are true then allow the flick. The seems to bulcky for me. Is there a simpler / more elegant way to do this?

Was it helpful?

Solution

The gestures library is not a polyfill, only a set of gestures we thought would be useful. The PointerEvents spec explicitly states that they will not design any higher level gestures.

I think you have a good point about canceling tracking when using multitouch pinch, as it would just be confusing otherwise.

Flick should always come after track events, as it only fires after the pointer is released.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top