locked
Have a gesture recognizer and still pass touch events to other controls

    Question

  • Hello all. I'm implementing  gesture recognition, following up this Dev Center discussion.

    I'd like to have most of the page sensible to the gesture recognition, in order to recognize horizontal swipe recognition.

    In order to do this, following Input: manipulations and gestures using JavaScript sample, one needs to have a transparent DIV overlapping the whole area, which is responsible of receiving the touch input events. In that sample the div is PointerSink and it has listeners for MSPointerDown/Move/Up events.

    By doing so, every other content in the page is prevented from receiving any touch event. Say I need a single tap to be received from an underlying "button", or e.g. a vertical swipe to be recognized by a panel with vertical scroll.

    How can I combine things such that both the gesture recognizer *and* other controls receive touch events? 

    Of course, I'm planning things such that the gesture recognizer (and no control) will react only to horizontal swipe.

    Friday, June 01, 2012 4:29 PM

Answers

  • Hi Gi,

    No, it would be some complicated logic for sure.  Generally you swipe objects and not the entire UI surface so I would attack the problem on a control, by control basis.

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, June 14, 2012 5:46 PM
    Moderator

All replies

  • Anyone out there that can suggest anything?

    Monday, June 04, 2012 7:51 PM
  • How about if you don't use the MSPointerDown etc... and use the tap instead?

    Since you are creating your own control in essence, look at the logic we have in ui.js.  specifically the onMSPointerUp.  It accommodates gestures, touch etc...

    Jeff Sanders (MSFT)


    Tuesday, June 05, 2012 7:58 PM
    Moderator
  • Hello there.

    My goal is to implement swipe gesture recognition. In another thread (see here), I was suggested to go and look at "Input: manipulations and gestures using JavaScript sample", which implemented what was needed.

    That sample does not actually implement the recognition of the gesture "per se", but at least implements the reception of touch events and the feeding of the GestureRecognizer.

    That's what I'd like to achieve. Now, I'd like to find the quickest way to reach that goal.

    I'd really appreciate if you could point me in the right direction.

    Thanks for your attention!

    Tuesday, June 05, 2012 8:48 PM
  • Any hint on this? Cheers
    Tuesday, June 12, 2012 6:19 PM
  • Hi Gi,

    No, it would be some complicated logic for sure.  Generally you swipe objects and not the entire UI surface so I would attack the problem on a control, by control basis.

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, June 14, 2012 5:46 PM
    Moderator