refactoring handleTouchEv