8000 Update README.md · Android-for-Python/gestures4kivy@d475c38 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 14, 2023. It is now read-only.

Commit d475c38

Browse files
Update README.md
1 parent ed8dbdd commit d475c38

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@ Where the `swipe_screen()` method configures the screen manager. This is fully i
5252

5353
`CommonGestures` callback methods detect gestures; they do not implement behaviors.
5454

55+
## Widget Interaction
56+
57+
In the example above gesture detection is *added* to the Widget, however some Kivy widgets consume events so they are not passed to CommonGestures. For example `ScrollView` consumes mouse wheel events so a `cgb_pan` is not detected.
58+
59+
```python
60+
class HScrollView(ScrollView, CommonGestures):
61+
62+
def cgb_pan(self, touch, focus_x, focus_y, delta_x, velocity):
63+
print('pan')
64+
# this is never called
65+
```
66+
67+
If this is not the required behavior, change the module resolution order. CommonGestures and ScrollView events will be called.
68+
69+
```python
70+
class HScrollView(CommonGestures, ScrollView):
71+
72+
def cgb_pan(self, touch, focus_x, focus_y, delta_x, velocity):
73+
print('pan')
74+
# this is always called
75+
```
76+
5577
## API
5678

5779
`CommonGestures` implements the following gesture callbacks, a child class may use any subset. The callbacks are initiated by input device events as described below.

0 commit comments

Comments
 (0)
0