Article Preview
Buy Now
FEATURE
Mouse Gestures
Issue: 3.4 (March/April 2005)
Author: Joe Strout
Author Bio: Joe Strout occasionally worked with mice and rats in his previous life as a neuroscientist, but never trained them to gesture.
Article Description: No description available.
Article Length (in bytes): 15,795
Starting Page Number: 16
Article Number: 3410
Resource File(s):
3410.zip Updated: 2013-03-11 19:07:58
Related Web Link(s):
http://www.strout.net/info/coding/rb/
http://www.merriampark.com/ld.htm
Excerpt of article text...
A "gesture" is a way of issuing a command to a computer or application by moving something -- typically a mouse or digital pen -- in a certain way. Gestures have a long history in the computing world, dating back at least to the Newton, and are still popular today in tablet PCs. Even with a mouse rather than a pen, many users feel that gestures are a much easier and more efficient way to interact with an application, especially in cases where you use the mouse much more than the keyboard -- for example, a drawing application or web browser.
Gestures should be defined in ways that are easy to remember. For example, a swipe to the left might mean "Go Back" while a swipe to the right means "Forward." A scribble over an object could mean "Delete This." Sometimes a gesture is really a letter: a letter "O" could stand for "Open" while a "C" might stand for "Close." Figure 1 shows some other sample gestures; the possibilities are endless.
If you're writing a mouse-intensive application, you should consider adding support for gestures too. You'll need some way to detect when a gesture has begun -- typically, this involves either a different mouse button, or a modifier key. Then you track the mouse during the drag, and when it's done, you match the stroke traced by the mouse to your set of gestures, and execute the corresponding command.
That's all there is to it, so have fun, and let me know how it goes... No, seriously though, we've glossed over the difficult part. No user can stroke exactly the same path twice, so how exactly do you match the stroke of the mouse to one of the gestures in a set? That's an artificial intelligence (AI) problem, in the general category of pattern matching. While you and I can look at a stroke and easily tell whether it's an "O" or a scribble, getting a computer to do the same task is much harder.
Fortunately, there is a fairly simple approach that works wonders on this particular pattern-matching problem. We'll also consider some ways that a similar approach might be used for other pattern-matching problems.
...End of Excerpt. Please purchase the magazine to read the full article.