processing / processing/p5.js

[p5.js 2.0+ Bug Report]: mouseIsPressed is unconditionally reset on multi-touch release

Open Beginner friendly
#9,013 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Events p5.js 2.0+
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)
p5.js version

2.x (main branch)

Web browser and version

chrome://150

Operating system

Windows 11

Steps to reproduce this

##Description

While testing multi-touch events, I noticed that mouseIsPressed is becoming false even when another finger is still touching the screen.

The expected behavior is that mouseIsPressed should stay true until all active touch points are released. Releasing one finger should not reset it if there are still other active pointers.

##Steps to reproduce

Touch the screen with one finger.
mouseIsPressed becomes true.
Touch the screen with a second finger.
Now there are two active pointers.
Release the second finger while keeping the first finger pressed.
mouseIsPressed becomes false, even though one finger is still touching the screen.

##Expected behavior

mouseIsPressed should only become false when the last active pointer is released.

##Actual behavior

mouseIsPressed becomes false whenever any pointer is released, even if other pointers are still active.

Possible cause

In src/events/pointer.js, the _onpointerup function sets:

this.mouseIsPressed = false;

without checking if there are any remaining active pointers.

The _onpointercancel handler already handles this correctly by checking:

if (this._activePointers.size === 0) {
this.mouseIsPressed = false;
}

The same check should probably be added to _onpointerup as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/events/pointer.js, comparing _onpointerup with the existing _onpointercancel behavior and its active-pointer tracking. Reproduce the two-finger sequence in Chrome, then verify that mouseIsPressed remains true until the final active pointer is released and becomes false afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.