Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pen tablets don't register mouse events on Firefox 59 + Windows 10 #1463

Open
nicholaswmin opened this issue Mar 21, 2018 · 2 comments · May be fixed by #1810
Open

Pen tablets don't register mouse events on Firefox 59 + Windows 10 #1463

nicholaswmin opened this issue Mar 21, 2018 · 2 comments · May be fixed by #1810

Comments

@nicholaswmin
Copy link

nicholaswmin commented Mar 21, 2018

Description/Steps to reproduce

  • Use a Pen tablet. Any tablet that reports pen pressure and will trigger PointerEvents.
  • Make sure the Pen tablet/digitiser reports Pen Pressure. For Wacom digitisers, make sure that:
    • Start -> Wacom Tablet Properties -> "Mapping" Tab -> "Use Windows Ink" is checked.
  • Visit this Sketch.
  • Try to draw with the pen tablet.

Link to reproduction test-case

http://sketch.paperjs.org/#S/dY/BCoMwDIZfJfSigvgAhZ2262Cwo/VQa6ZSTaSt8yC++6yMDQbL6c/3J+TPKkiPKKS4WwymE7kw3MT+qR1MOnSKFEXNdOXZ44UXghM8ZjKhZ0oxg1URHKM7J1zgtsv0gLE8tiNS8BJKLCbuKVT5xwuOLZ55YCchqQdtbPI1cUATsJEQ3IyRbpmi7TeP0+2/PIVumvR9NK7uz9UOtT2AF7Ksthc=

Expected result

  • Draws freehand drawings

Actual result

  • Draws nothing

Additional information

  • Only applicable on Windows 10 + Firefox 59.
  • Firefox 59 on OSX doesn't have this issue.
  • Firefox 58 does not have this issue since it doesn't implement the PointerEvents API.
  • Turning off Pen Pressure (Windows Ink on Wacoms) fixes this since it causes the device to report as a e.pointerType = 'mouse' instead of a 'pen'.
    • However Firefox 59 logs wrong e.clientX/e.clientY values if a pen is used that doesn't identify itself as a pointerType = 'pen' .
    • This is a Firefox 59 + Windows 10 bug I've reported here that has nothing to do with PaperJS.

Workaround

I do this as a temp. workaround.

;(() => {
  const isFirefox59 = () => window.navigator.userAgent.includes('Firefox/59.0')
  const isWindows64 = () => window.navigator.platform.includes('Win64')

  if (isFirefox59() && isWindows64()) {
    console.warn('Detected Firefox 59+ on Windows 10. Some PointerEvents are remapped to MouseEvents. For more info see: https://github.com/paperjs/paper.js/issues/1463')

    window.addEventListener('pointerdown', e => {
      e.target.dispatchEvent(new MouseEvent('mousedown', e))

      e.stopPropagation()
      e.preventDefault()
    })

    window.addEventListener('pointermove', e => {
      e.target.dispatchEvent(new MouseEvent('mousemove', e))

      e.stopPropagation()
      e.preventDefault()
    })

    window.addEventListener('pointerup', e => {
      e.target.dispatchEvent(new MouseEvent('mouseup', e))

      e.stopPropagation()
      e.preventDefault()
    })
  }
})()
@sberney
Copy link

sberney commented Feb 19, 2020

@nicholaswmin Does this still occur in 2020? I just tested it with a stylus on a Surface Book 2, which reports force, and I do not have this problem.

@sambartik
Copy link

@sberney I can confirm that it still occurs. Setting the 'dom.w3c_pointer_events.dispatch_by_pointer_messages' to true in about:config seems to fix it.

@adroitwhiz adroitwhiz linked a pull request May 19, 2020 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants