Added long press gesture and motion event handling functionality.