From b8c5da317372bf6ed3349c9b023b9b1203b26267 Mon Sep 17 00:00:00 2001 From: Reeju Bhattacharya Date: Sun, 6 Feb 2022 22:42:59 +0530 Subject: [PATCH] fixes issue #5191 along with minor grammatical edits --- src/events/mouse.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/events/mouse.js b/src/events/mouse.js index ae449c3191..5380952720 100644 --- a/src/events/mouse.js +++ b/src/events/mouse.js @@ -984,7 +984,10 @@ p5.prototype._onwheel = function(e) { * Note that not all browsers support this feature. * This enables you to create experiences that aren't limited by the mouse moving out of the screen * even if it is repeatedly moved into one direction. - * For example, a first person perspective experience. + * For example, a first person perspective experience. It is recommended to + * use requestPointerLock() as a result + * of any user interaction, like mouseClicked() + * or keyPressed() * * @method requestPointerLock * @example @@ -993,7 +996,6 @@ p5.prototype._onwheel = function(e) { * let cam; * function setup() { * createCanvas(100, 100, WEBGL); - * requestPointerLock(); * cam = createCamera(); * } * @@ -1003,6 +1005,10 @@ p5.prototype._onwheel = function(e) { * cam.tilt(movedY * 0.001); * sphere(25); * } + * + * function mouseClicked() { + * requestPointerLock(); + * } * * * @@ -1024,8 +1030,8 @@ p5.prototype.requestPointerLock = function() { /** * The function exitPointerLock() - * exits a previously triggered pointer Lock - * for example to make ui elements usable etc + * exits a previously triggered pointer Lock. + * For example, it might be used to make UI elements usable once again. * * @method exitPointerLock * @example