Skip to content

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

Description

@jayant733

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions