Skip to content

Incorrect docs about mouse position in WEBGL mode #8002

@ericrav

Description

@ericrav

The documentation for mouseX states:

In WebGL mode, mouseX keeps track of the mouse's position relative to the center of the canvas. For example, if the mouse is 50 pixels to the right of the canvas' center, then mouseX will be 50.

I take this to also mean if the cursor is at the center of the canvas, mouseX/mouseY will be 0,0.

However, this does not appear to be true in p5.js with WEBGL mode, as can be seen in the last example on the docs page: when placing the cursor at the center of the canvas, mouse position is 50, 50. If the mouse is 50 pixels to the right of the canvas' center, then mouseX is 100.

Image

I'm not sure if this is a mistake in the docs or a bug in p5.js

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions