Added touch and pan event handling.