bitbof / klecks

Community funded painting tool powering Kleki.com
https://klecks.org
MIT License
220 stars 69 forks source link

Firefox user agent detection prevents users to benefit from pressure drawing. #4

Closed karlcow closed 2 years ago

karlcow commented 2 years ago

On https://github.com/webcompat/web-bugs/issues/99826#issuecomment-1061461720

@dholbert determined there was user agent detection against Firefox which removed the ability for Firefox users to use the pressure for affecting the drawing.

Could you fix it?

bitbof commented 2 years ago

Thanks for reaching out & spotting this! I pushed & released a fix that enables pressure in Firefox. I think I used to have problems with PointerEvents on mobile, but it seems to be working fine when I was testing it just now.

saschanaz commented 2 years ago

Thanks! I still see isFirefox uses, can those be removed too or are there still problems?

Edit: Pressure now works on Surface Pro 7 👍

bitbof commented 2 years ago

Glad that it's working now!

I used to have a few more problems with PointerEvents when testing on Windows 10:

I will check if those are still around. The last time I tested was ~2 years ago. If the bold issues are gone I can remove isFirefox.

saschanaz commented 2 years ago

movementX/Y are equal to pageX/Y in coalesced events (not 100% on this)

I can confirm this: https://bugzilla.mozilla.org/show_bug.cgi?id=1753724. I guess the following is the relevant code here:

https://github.com/bitbof/klecks/blob/aebb515c6180801cfedae8af230ca7850fda0cc0/src/app/script/bb/base/browser.ts#L27-L45

I think others are okay now. Please ping if not 👍

bitbof commented 2 years ago

Thanks for confirming. Yes that's the relevant code. Perhaps there is a way to check for that issue that doesn't involve useragent sniffing.

I'll keep an eye on that ticket.

bitbof commented 2 years ago

@saschanaz The second issue "when using pen, values of 'button' and 'buttons' are irregular" is still present. I've created a demonstration page: https://bitbof.com/stuff/2022-03-08-ff-pointer-buttons/ The first pointermove after pointerdown sometimes has the value 0 for buttons.

Screenshot (top are the most recent pointer events): 2022_03_08_screenshot

saschanaz commented 2 years ago

Interesting, which device are you using? I don't see such inconsistency on Surface Pro 7 (Windows 11) 🤔, I wonder whether this is device specific...

saschanaz commented 2 years ago

Oh, never mind. I also see it from some of the first pointermove events.

bitbof commented 2 years ago

Yea it doesn't happen every time. I've created a separate issue for removing isFirefox: https://github.com/bitbof/klecks/issues/5

saschanaz commented 2 years ago

https://bugzilla.mozilla.org/show_bug.cgi?id=1758516, btw.

bitbof commented 2 years ago

Thanks! Shouldn't that be "pointermove shouldn't return buttons: 0"?

saschanaz commented 2 years ago

Oops, sure. Fixed it.