stuyam / pressure

:point_down::boom: JavaScript library for handling Force Touch, 3D Touch, and Pointer Pressure.
https://pressurejs.com
MIT License
2.91k stars 98 forks source link

Considering Pointer Events Pressure for pressure in Chrome #60

Closed bhaux closed 7 years ago

bhaux commented 7 years ago

Hi Stuart! We've been looking for a solution to make reading pressure across browsers and platforms less of a pain than it currently is and this is exactly it! Thank you for this fantastic library!

Now to our question/issue: We're working with wacoms mostly and it seems that since Chrome 55/56 pointer events are now supported by default, delivering pressure from http://caniuse.com/#feat=pointer (at least verified with wacom on OS X). Is there a chance PE can be considered to read pressure within pressure.js?

There are a few gotchas though:

stuyam commented 7 years ago

@bhaux awesome! Thank you for the information I did not know that it was started to be included in browsers that is great news.

I also did not know that it worked with thinks like Wacom tablets that is awesome fantastic! Luckily I have one and using the link you posted I was able to see the pressure values with the Wacom. (Side note I actually didn't know that 'pressure' was the name of the pointer event value until after naming pressurejs).

I setup pressure to have adapters, currently there are 2, 3dTouch and ForceTouch adapters. I tried to set it up in a way that I could add more adapters in the future when things like pointer events started working.

I am eager to start integrating this and would love help from anyone willing. Luckily the pointer events are standardized so that will future proof this project as well.

As for the two "gotchas" that you found, I am not sure how to get around them just yet but I hope I will figure something out. Hopefully with Firefox I can enable those in the library but not sure yet.

Thanks again for the suggestion.

stuyam commented 7 years ago

@bhaux curious what you are using wacom tablets on the web for. Sounds interesting!

stuyam commented 7 years ago

I have successfully been able to get pointer events to work in chrome and opera on mac with my wacom tablet.

The firefox issue it looks like I can not get around. There is a "windows only" fix but I am not sure how that works.

As for the chrome issues of being at 0 and 0.5 force on the track pad I was able to get around that by checking if the pressure values is not exactly 0 nor exactly 0.5 because that values are always some super long trailing decimal.

Will hopefully be able to have something to release soon.

bhaux commented 7 years ago

those are great news! I'll pm you more details on our work : )

stuyam commented 7 years ago

Coming soon in version 2.1.0 of pressure.

stuyam commented 7 years ago

Released in v2.1.0: https://github.com/stuyam/pressure/releases/tag/v2.1.0

Thanks @bhaux for the awesome suggestion, it future proofs pressure! I didn't know support had started to be included in browsers for Pointer Events 🎉

bhaux commented 7 years ago

Thank you Stuart! You Rock : )