Skip to content

Commit 49dd565

Browse files
authored
Merge pull request #429 from hx2A/mousewheel
improve mouse wheel docs
2 parents 1aa781e + 51534a4 commit 49dd565

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

py5_docs/Reference/api_en/Py5MouseEvent_get_count.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ get_count() -> int
1010
@@ description
1111
Get the number of mouse clicks. This will be 1 for a single mouse click and 2 for a double click. The value can be much higher if the user clicks fast enough.
1212

13+
This method also responds to the mouse wheel. It will be 1 when the mouse wheel is rotating down and -1 when the mouse wheel is rotating up.
14+
1315
@@ example
1416
def setup():
1517
py5.size(200, 200, py5.P2D)
@@ -22,3 +24,8 @@ def draw():
2224

2325
def mouse_clicked(e):
2426
py5.println('mouse click count:', e.get_count())
27+
28+
29+
def mouse_wheel(e):
30+
direction = "down" if e.get_count() == 1 else "up"
31+
py5.println(f"mouse wheel rotating {direction}")

0 commit comments

Comments
 (0)