I'm having difficulties implementing multi-touch panning with hammer.js. Panning events are only fired with single pointers. If I try to drag with two fingers it does not fire until I release at least one finger. Do I have to do something special to the hammer configuration?
EDIT: I already found that I can configure 2 pointers for the pan event, but now I see that Chrome has a built-in feature to open a context menu on two-finger tap, which most of the time prevents the panning from being recognized. If I simply catch the 'contextmenu' event and call preventDefault(), it will (obviously) completely disable the pan recognizer. Any other way?
BR, Daniel
You should use 'pinch' event. For two-fingers panning and zooming. PINCH event has property: 'pointers', with finger events;
var previous_pinch_delta = {
x: 0,
y: 0
};
hammered.on('pinch', function(e){
camera.pan(e.deltaX-previous_pinch_delta.x, e.deltaY-previous_pinch_delta.y);
previous_pinch_delta = {
x: e.deltaX,
y: e.deltaY
};
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With