Directory

← Back

SimpleGesture

A simple, easy to use GWT and Vaadin component for gesture recognition.

Author

Rating

Popularity

<100

SimpleGesture is a Vaadin (and plain GWT) component for mouse gesture recognition. It uses a simple, but accurate, algorithm for gesture recognition, which represents the gesture as a human (well, programmer) readable string.

The gesture is encoded with numbers representing directions (left-right would be "40", see screenshot), and matching is done using the Levenshtein distance algorithm, which also tells you how closely the gesture was matched.

SimpleGesture also supports recording and detection of similar gestures.

See links for more details, and a demo.

Sample code

        // Set up some initial gestures
        SimpleGesture sg.addGesture("5443", "Counter clockwise"); // nw, w, w, sw
        sg.addGesture("7001", "Clockwise"); // ne, e, e, se
        sg.addGesture("321076543", "Circle"); // etc
        sg.addGesture("43210134", "Squiggle");

        // The listener that reacts to gestures - we'll just show the gesture
        // name as a notification.
        sg.addListener(new SimpleGesture.GestureListener() {
            public void gesture(GestureEvent event) {
                if (sg.isRecordMode()) {
                    sg.setRecordMode(false);
                    record.setCaption("Record gesture");
                    getMainWindow().addComponent(
                            new AddGesture(event.getMoved()));
                } else {
                    getMainWindow()
                            .showNotification(event.getData().toString());
                }
            }
        });
        // The component is invisible but needs to be in the layout anyway.
        mainWindow.addComponent(sg);

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Released
2010-01-22
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.0+
Browser
N/A

SimpleGesture - Vaadin Add-on Directory

A simple, easy to use GWT and Vaadin component for gesture recognition. SimpleGesture - Vaadin Add-on Directory
SimpleGesture is a Vaadin (and plain GWT) component for mouse gesture recognition. It uses a simple, but accurate, algorithm for gesture recognition, which represents the gesture as a human (well, programmer) readable string. The gesture is encoded with numbers representing directions (left-right would be "40", see screenshot), and matching is done using the Levenshtein distance algorithm, which also tells you how closely the gesture was matched. SimpleGesture also supports recording and detection of similar gestures. See links for more details, and a demo.
Online