Skip to content

Commit c5ce69a

Browse files
author
Lauren McCarthy
committed
Merge branch 'master' of github.com:processing/p5.js
2 parents d47eb58 + e1df76d commit c5ce69a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/core/p5.Element.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,17 @@ p5.Element.prototype.mousePressed = function (fxn) {
195195
/**
196196
* The .mouseWheel() function is called once after every time a
197197
* mouse wheel is scrolled over the element. This can be used to
198-
* attach element specific event listeners.<br><br>
199-
* The event.wheelDelta or event.detail property returns negative values if
200-
* the mouse wheel if rotated up or away from the user and positive in the
201-
* other direction. On OS X with "natural" scrolling enabled, the values are
202-
* opposite.
198+
* attach element specific event listeners.
199+
* <br><br>
200+
* The function accepts a callback function as argument which will be executed
201+
* when the `wheel` event is triggered on the element, the callabck function is
202+
* passed one argument `event`. The `event.deltaY` property returns negative
203+
* values if the mouse wheel is rotated up or away from the user and positive
204+
* in the other direction. The `event.deltaX` does the same as `event.deltaY`
205+
* except it reads the horizontal wheel scroll of the mouse wheel.
206+
* <br><br>
207+
* On OS X with "natural" scrolling enabled, the `event.deltaY` values are
208+
* reversed.
203209
*
204210
* @method mouseWheel
205211
* @param {Function} fxn function to be fired when mouse wheel is
@@ -231,8 +237,8 @@ p5.Element.prototype.mousePressed = function (fxn) {
231237
*
232238
* // this function fires with mousewheel movement
233239
* // over canvas only
234-
* function changeSize() {
235-
* if (event.wheelDelta > 0) {
240+
* function changeSize(event) {
241+
* if (event.deltaY > 0) {
236242
* d = d + 10;
237243
* } else {
238244
* d = d - 10;

0 commit comments

Comments
 (0)