define(["dom","events"],function(dom,events){"use strict";function getTouches(e){return e.changedTouches||e.targetTouches||e.touches}function TouchHelper(elem,options){options=options||{};var touchTarget,touchStartX,touchStartY,lastDeltaX,lastDeltaY,thresholdYMet,self=this,swipeXThreshold=options.swipeXThreshold||50,swipeYThreshold=options.swipeYThreshold||50,swipeXMaxY=30,excludeTagNames=options.ignoreTagNames||[],touchStart=function(e){var touch=getTouches(e)[0];if(touchTarget=null,touchStartX=0,touchStartY=0,lastDeltaX=null,lastDeltaY=null,thresholdYMet=!1,touch){var currentTouchTarget=touch.target;if(dom.parentWithTag(currentTouchTarget,excludeTagNames))return;touchTarget=currentTouchTarget,touchStartX=touch.clientX,touchStartY=touch.clientY}},touchEnd=function(e){var isTouchMove="touchmove"===e.type;if(touchTarget){var deltaX,deltaY,clientX,clientY,touch=getTouches(e)[0];touch?(clientX=touch.clientX||0,clientY=touch.clientY||0,deltaX=clientX-(touchStartX||0),deltaY=clientY-(touchStartY||0)):(deltaX=0,deltaY=0);var currentDeltaX=null==lastDeltaX?deltaX:deltaX-lastDeltaX,currentDeltaY=null==lastDeltaY?deltaY:deltaY-lastDeltaY;lastDeltaX=deltaX,lastDeltaY=deltaY,deltaX>swipeXThreshold&&Math.abs(deltaY)swipeYThreshold||thresholdYMet)&&Math.abs(deltaX)