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

Support for decreasing change() event #56

Closed lkostrowski closed 7 years ago

lkostrowski commented 7 years ago

change() is triggering only increasing, while native support includes force change both ways. Is it possible to implement?

stuyam commented 7 years ago

Thanks for the feedback @vorthess!

I have thought of this before, kept deciding it wasn't necessary but I have seen a few examples where people implement it themselves so maybe it would be useful if it was prebuilt.

Maybe have like a "polyfillSpeedUp" and "polyfillSpeedDown" config option that would default to 1 second.

I guess I would have to think about how it would work in terms of enabling and disabling that specific behavior. The polyfill is enabled by default in v2 of pressure. Would the "Down" be another setting? Would it be on by default? Would love to hear other peoples thoughts on this.

@marcusmolchany @henrahmagix

henrahmagix commented 7 years ago

Yeah, that would be a nice thing to come prebuilt. polyfillSpeedUp and polyfillSpeedDown options make sense :+1:

I think it should be off by default, so the effect of lifting your finger off the screen is the same for both supported and unsupported: the thing snaps back to its default state.

Maybe "off" is simply polyfillSpeedDown: 0 to reduce configuration code?

stuyam commented 7 years ago

@henrahmagix smart idea with setting the default of polyfillSpeedDown: 0 I like that.

@vorthess, curious about what your application of this would be?

lkostrowski commented 7 years ago

@stuyam Im creating internal time tracking tool for my company, hybrid app in meteor, react, electron. Im using iphone 7 and I love 3d touch, so I want to implement few UI features ;)

stuyam commented 7 years ago

Haven't had time to work on this yet. Would love help on this is people are willing 😄

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 Hope you find in useful! 😄