Open schoening opened 6 years ago
Ideally, it would be great if you could provide a "buttons" attribute on the pan event object to know which button was pressed during paning.
If in the code of {hammer.js} you look for this code:
// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}
replace it with this one:
// on start we want to have the left and middle mouse button down
if (eventType & INPUT_START && ev.button < 2) {
this.pressed = true;
}
and if you look for:
// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}
and replace it with this:
// on start we want to have the left or middle mouse button down
if (eventType & INPUT_START && ev.button < 2) {
this.pressed = true;
}
then, the pan event is emitted with the middle button too.
You can check the attribute evt.srcEvent.buttons
to know which button was pressed.
I don't know if this will break something else in Hammer lib. But until now, I didn't see any problem.
@tolokoban thank you, I am going to give it a try. Is the bitwise AND on purpose or did you mean to write && ?
It's on purpose, but it's just the original code here.
It seems that the inputType
can be multiple.
Hi, is it possible to make the middle mouse button trigger the pan gesture instead of the left one?