Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:48:14+00:00 2026-05-23T20:48:14+00:00

I have an IObservable<TouchLocation> and am trying to derive gestures from it. Was able

  • 0

I have an IObservable<TouchLocation> and am trying to derive gestures from it.

Was able to pull out Taps but having trouble wrapping my head around Double Tap.

TouchLocation has Position and State so Tap is derived by aggregating these based upon two criteria.

1) Position doesn’t move more than 10px in any direction (allow for some movement but isn’t a drag)

2) Starts on an event with “Pressed” state and continues until one comes in with “Released” state

3) Where the “release” happens within 1 second of the “press”

Now I have an IObservable<List<TouchLocation>> (result of the aggregation) and need to produce the double tap.

How can I return the first gesture (to produce the initial tap) and then substitute the second for a double tap gesture, but only if a second Tap is received before a 1 second timer. If received after the timer then it should also be a simple Tap.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:48:15+00:00Added an answer on May 23, 2026 at 8:48 pm

    A fun problem.

    // Setup some parameters
    var singleTapInterval = TimeSpan.FromSeconds(0.5);
    var dblTapInterval = TimeSpan.FromSeconds(1);
    
    // the source of touches
    IObservable<TouchLocation> txs; 
    
    // Get single taps
                                   // 0, 1, but no more than 
                                   // 2 touches in the timespan
    IObservable<TouchLocation> taps = txs.Buffer(2,singleTapInterval) 
                                        .Where(touches => touches.Count == 2 &&
                                               touches[0].state == "Pressed" &&
                                               touches[1].state == "Released" &&
                                               distance(touches) < distanceThreshold)
                                        .Select(touches => touches[1]);
    
    // now detect double taps
    IObservable<TapKind> dbltaps = taps.Buffer(2,dblTapInterval)
                                       .Where(taps => taps.Count == 2)
                                       .Select(_ => TapKind.SingleTap);
    
    // detect single taps - taps must be _slower_ than the dblTapInterval 
    // for this to work
    IObservable<TapKind> singletaps = taps.Throttle(dblTapInterval)
                                          .Select(_ => TapKind.SingleTap);
    
    // compbine the two, so we see either tap condition
    IObservable<TapKind> interestingTaps = dbltaps.Merge(singletaps);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a IObservable [named rows in the sample below] from Reactive extensions framework
I'm testing out the Reactive Extensions (main branch from NuGet) and I'm having some
You have a pull-oriented Observable/Listenable which notifies Observers/Listeners when some state changes. The state
I have been trying to create an observable tweeter feed using tweetsharp with the
I have made a generic Observer interface and an Observable class, but can't compile
Say I have a factory method that churns out instances of type T, and
I have the following situation: My library makes use of the IObservable interface, inluded
I have the following Rx Query that produces a IObservable problem is it does
I have a hot observable (from an event) that I'm calling DistinctUntilChanged on which
I have a WinFrom App, use synchronous method to download string from a url,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.