문제

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!

도움이 되었습니까?

해결책 2

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top