Use the GestureLayer to detect gestures. The advantage is that you don’t have to implement gesture detection, just set callbacks for gesture states.
In order to use Gesture Layer you start with instantiating this class with a parent object parameter. Next ‘activate’ gesture layer with a attach() call. Usually with same object as target (2nd parameter).
Now you need to tell gesture layer what gestures you follow. This is done with cb_set() call. By setting the callback you actually saying to gesture layer: I would like to know when the gesture Gesture types switches to state Gesture states.
Next, you need to implement the actual action that follows the input in your callback.
Note that if you like to stop being reported about a gesture, just set all callbacks referring this gesture to None. (again with cb_set())
The information reported by gesture layer to your callback is depending on Gesture types:
GestureTapsInfo is the info reported for tap gestures:
GestureMomentumInfo is info reported for momentum gestures:
GestureLineInfo is the info reported for line gestures (this also contains GestureMomentumInfo internal structure):
Note that we consider a flick as a line-gesture that should be completed in flick-time-limit as defined in Configuration.
GestureZoomInfo is the info reported for ELM_GESTURE_ZOOM gesture.
GestureRotateInfo is the info reported for ELM_GESTURE_ROTATE gesture.
Gesture Layer Tweaks:
Note that line, flick, gestures can start without the need to remove fingers from surface. When user fingers rests on same-spot gesture is ended and starts again when fingers moved.
Setting glayer_continues_enable to false in Configuration will change this behavior so gesture starts when user touches (a DOWN event) touch-surface and ends when no fingers touches surface (a UP event).
Gesture not started
Gesture started
Gesture is ongoing
Gesture completed
Ongoing gesture was aborted
N fingers single taps
N fingers single long-taps
N fingers double-single taps
N fingers triple-single taps
Reports momentum in the direction of move
N fingers line gesture
N fingers flick gesture
Zoom
Rotate
Bases: efl.elementary.__init__.Object
This is the class that actually implement the widget.
Note
You have to call attach() in order to ‘activate’ gesture-layer.
Parameters: |
|
---|
Attach a given gesture layer widget to an Evas object, thus setting the widget’s target.
A gesture layer target may be whichever Evas object one chooses. This will be object obj will listen all mouse and key events from, to report the gestures made upon it back.
Parameters: | target (Object) – The target object to attach to this object. |
---|
Changed in version 1.8: Raise RuntimeError on failure, instead of returning a bool
Use this function to set callbacks to be notified about change of state of gesture. When a user registers a callback with this function this means this gesture has to be tested.
When ALL callbacks for a gesture are set to None it means user isn’t interested in gesture-state and it will not be tested.
The signature for the callbacks is:
func(event_info, *args, **kwargs)
Note
You should return either EVAS_EVENT_FLAG_NONE or EVAS_EVENT_FLAG_ON_HOLD from this callback.
Parameters: |
|
---|
Gesture layer continues enable of an object
Type: | bool |
---|
New in version 1.8.
Gesture layer double tap timeout of an object
Type: | double |
---|
New in version 1.8.
Gesture layer flick time limit (in ms) of an object
Type: | int |
---|
New in version 1.8.
Gesture-layer repeat events. Set to True if you like to get the raw events only if gestures were not detected. Set to false if you like gesture layer to forward events as testing gestures.
Type: | bool |
---|
Gesture layer line angular tolerance of an object
Type: | double |
---|
New in version 1.8.
Gesture layer line distance tolerance of an object
Type: | int |
---|
New in version 1.8.
Gesture layer line min length of an object
Type: | int |
---|
New in version 1.8.
Gesture layer long tap start timeout of an object
Type: | double |
---|
New in version 1.8.
Gesture layer rotate angular tolerance of an object
Type: | double |
---|
New in version 1.8.
This function sets step-value for rotate action. Set step to any positive value. Cancel step setting by setting to 0
Type: | float |
---|
The gesture layer finger-size for taps. If not set, this size taken from elm_config. Set to ZERO if you want GLayer to use system finger size value (default)
Type: | int |
---|
New in version 1.8.
Gesture layer zoom distance tolerance of an object
Type: | int |
---|
New in version 1.8.
Gesture layer zoom finger factor of an object
Type: | double |
---|
New in version 1.8.
Step-value for zoom action. Set step to any positive value. Cancel step setting by setting to 0.0
Type: | float |
---|
Gesture layer zoom wheel factor of an object
Type: | double |
---|
New in version 1.8.