Skip to content

Commit

Permalink
refactor 2114
Browse files Browse the repository at this point in the history
- clean up the code from mazzaker to be more like
  the original style, and also add readability spacings
  • Loading branch information
simeydotme committed Feb 23, 2016
1 parent ccb028f commit 3309c97
Showing 1 changed file with 48 additions and 17 deletions.
65 changes: 48 additions & 17 deletions slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -2480,37 +2480,68 @@

_.dragging = false;
_.interrupted = false;
_.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;

_.shouldClick = (_.touchObject.swipeLength > 10) ? false : true;

if (_.touchObject.curX === undefined) {
if ( _.touchObject.curX === undefined ) {
return false;
}

if (_.touchObject.edgeHit === true) {
_.$slider.trigger('edge', [_, _.swipeDirection()]);
if ( _.touchObject.edgeHit === true ) {
_.$slider.trigger('edge', [_, _.swipeDirection() ]);
}

if (_.touchObject.swipeLength >= _.touchObject.minSwipe) {
if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {

direction = _.swipeDirection();
if(direction != 'vertical'){
if(direction == 'left' || direction == 'down') {
slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount();

switch ( direction ) {

case 'left':
case 'down':

slideCount =
_.options.swipeToSlide ?
_.checkNavigable( _.currentSlide + _.getSlideCount() ) :
_.currentSlide + _.getSlideCount();

_.currentDirection = 0;
}
else if(direction == 'right' || direction == 'up') {
slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount();

break;

case 'right':
case 'up':

slideCount =
_.options.swipeToSlide ?
_.checkNavigable( _.currentSlide - _.getSlideCount() ) :
_.currentSlide - _.getSlideCount();

_.currentDirection = 1;
}
_.slideHandler(slideCount);

break;

default:


}

if( direction != 'vertical' ) {

_.slideHandler( slideCount );
_.touchObject = {};
_.$slider.trigger('swipe', [_, direction]);
_.$slider.trigger('swipe', [_, direction ]);

}

} else {
if (_.touchObject.startX !== _.touchObject.curX) {
_.slideHandler(_.currentSlide);

if ( _.touchObject.startX !== _.touchObject.curX ) {

_.slideHandler( _.currentSlide );
_.touchObject = {};

}

}

};
Expand Down

0 comments on commit 3309c97

Please sign in to comment.