Question

I was wondering if is there any way to get the pressure level (pressure user makes on clicking on mouse key/button) on click. Any resource or links?

Sorry for my bad english, hope my question is clear and hope is not just utopia!

Was it helpful?

Solution 2

The mouse (hardware) doesn't register how hard you click it, and javascript can't track something that doesn't exist.

OTHER TIPS

I realize that I'm bumping an old thread with something that wasn't relevant then, but I believe this will be useful to others in the future.

As many others on this thread have pointed out, almost all computer mice don't measure the pressure used, so you cannot measure it. However, there are different pointing devices than mice out there, like drawing tablets or trackpads. In Gecko-based browsers like Firefox, there is the non-standard mozPressure attribute on mouse events. You would use it sort of like this:

document.addEventListener('click', function (e) {
    alert(e.mozPressure);
});

mozPressure is a value between 0.0 and 1.0 depending on how hard the mouse was depressed. If you're using a normal mouse or something else that doesn't detect pressure, then this will always be 0.

Reference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top