Skip to content

Clicks not detected when connecting a mouse to iPad  #1959

@danrha

Description

@danrha

Currently Paper.js isn't listening to mouse events (mousedown, mousemove, mouseup) for practically any device supporting ontouchstart. This is causing clicks coming from mice connected to tablets or phones to not be detected by Paper.js tools.

paper.js/src/view/View.js

Lines 1079 to 1090 in 56d153a

mousedown = 'touchstart';
mousemove = 'touchmove';
mouseup = 'touchend touchcancel';
// Do not add mouse events on mobile and tablet devices
if (!('ontouchstart' in window && navigator.userAgent.match(
/mobile|tablet|ip(ad|hone|od)|android|silk/i))) {
// For non pointer events browsers and mixed browsers, like chrome
// on Windows8 touch laptop.
mousedown += ' mousedown';
mousemove += ' mousemove';
mouseup += ' mouseup';
}

I'm creating a PR to remove the check and listen to both touch and mouse events instead of excluding mouse on touch devices.

Description/Steps to reproduce

  1. Create a tool using a mouse event
  2. Click using a mouse connected to a touch device, the event will not be detected

Link to reproduction test-case

https://plnkr.co/edit/vUzAv72ZNODG3aSG

Expected result

Yellow circle should move to the pointer location

Additional information

Tested on iOS & iPadOS 15, should be reproducible on other versions of iOS and Android tablets.

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