views:

107

answers:

1

The documentation for the GestureRecognizer class in .NET states that the sort order of the results returned by the Recognize method has to do with how strong the confidence is.

However, when I created my own sample (in WPF, .NET 3.5sp1) that creates a recognizer I do not see this behavior. For the record, i set the recognizer to recognize all possible gestures (ApplicationGesture.AllGestures).

My code starts with MouseDown and then records all points on MouseMove until it receives a MouseUp event which then calls recognizer.Recognize() on a stroke generated from all these points (typically in the range of 100 points or so).

What I often get is 4+ hits sorted like this (reported confidence in brackets):

  1. NoGesture (Strong)
  2. ArrowLeft (Intermediate)
  3. Square (Strong)
  4. ChevronDown (Strong)

Is this a bug? Should I only pay attention to the first item in the array?

+1  A: 

My experience working with this was that the order of items in the result set was at least somewhat arbitrary. I wound up sorting by confidence (descending) and then the likelyhood that it was a desired gesture (based on context) and a sense of how much of a change a given gesture makes to the application state.

For example: If I knew that circle was a "select this item" gesture and Square was a "Rebuild cached data for this item, which might take 5 minutes since we go off to multiple external services" (obviously a poor choice of gestures, given the similarity), I would prefer to pick Circle if both came back with the same confidence. Sometimes I would even take a lower confidence over a higher one (say, within one level).

This does require a strong sense of context in your application, but I found it to be valuable to ensure that you didn't get two "strong" confidences and wound up doing the one that took more work to undo. One thing that is always true about these gestural interfaces is that we will never do the right thing 100% of the time, so doing the least damage if we're wrong is something to keep in mind.

Ben Von Handorf