Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

enforce typeof carouselIndex #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions dist/angular-carousel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Angular Carousel - Mobile friendly touch carousel for AngularJS
* @version v1.0.1 - 2016-03-05
* @version v1.0.1 - 2016-03-25
* @link http://revolunet.github.com/angular-carousel
* @author Julien Bouquillon <[email protected]>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -136,7 +136,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach

})

.service('computeCarouselSlideStyle', ["DeviceCapabilities", function(DeviceCapabilities) {
.service('computeCarouselSlideStyle', function(DeviceCapabilities) {
// compute transition transform properties for a given slide and global offset
return function(slideIndex, offset, transitionType) {
var style = {
Expand Down Expand Up @@ -186,7 +186,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
}
return style;
};
}])
})

.service('createStyleString', function() {
return function(object) {
Expand Down Expand Up @@ -329,7 +329,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
}

scope.nextSlide = function(slideOptions) {
var index = scope.carouselIndex + 1;
var index = scope.carouselIndex*1 + 1;
if (index > currentSlides.length - 1) {
index = 0;
}
Expand All @@ -339,7 +339,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
};

scope.prevSlide = function(slideOptions) {
var index = scope.carouselIndex - 1;
var index = scope.carouselIndex*1 - 1;
if (index < 0) {
index = currentSlides.length - 1;
}
Expand All @@ -350,7 +350,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
//console.log('goToSlide', arguments);
// move a to the given slide index
if (index === undefined) {
index = scope.carouselIndex;
index = scope.carouselIndex*1;
}

slideOptions = slideOptions || {};
Expand Down Expand Up @@ -589,22 +589,22 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
slidesMove = -Math[absMove >= 0 ? 'ceil' : 'floor'](absMove / elWidth),
shouldMove = Math.abs(absMove) > minMove;

if (currentSlides && (slidesMove + scope.carouselIndex) >= currentSlides.length) {
slidesMove = currentSlides.length - 1 - scope.carouselIndex;
if (currentSlides && (slidesMove + scope.carouselIndex*1) >= currentSlides.length) {
slidesMove = currentSlides.length - 1 - scope.carouselIndex*1;
}
if ((slidesMove + scope.carouselIndex) < 0) {
slidesMove = -scope.carouselIndex;
if ((slidesMove + scope.carouselIndex*1) < 0) {
slidesMove = -scope.carouselIndex*1;
}
var moveOffset = shouldMove ? slidesMove : 0;

destination = (scope.carouselIndex + moveOffset);
destination = (scope.carouselIndex*1 + moveOffset);

goToSlide(destination);
if(iAttributes.rnCarouselOnInfiniteScrollRight!==undefined && slidesMove === 0 && scope.carouselIndex !== 0) {
if(iAttributes.rnCarouselOnInfiniteScrollRight!==undefined && slidesMove === 0 && scope.carouselIndex*1 !== 0) {
$parse(iAttributes.rnCarouselOnInfiniteScrollRight)(scope)
goToSlide(0);
}
if(iAttributes.rnCarouselOnInfiniteScrollLeft!==undefined && slidesMove === 0 && scope.carouselIndex === 0 && moveOffset === 0) {
if(iAttributes.rnCarouselOnInfiniteScrollLeft!==undefined && slidesMove === 0 && scope.carouselIndex*1 === 0 && moveOffset === 0) {
$parse(iAttributes.rnCarouselOnInfiniteScrollLeft)(scope)
goToSlide(currentSlides.length);
}
Expand Down Expand Up @@ -642,7 +642,7 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach
bufferIndex = currentSlides.length - scope.carouselBufferSize;
} else {
// compute buffer start
bufferIndex = scope.carouselIndex - bufferEdgeSize;
bufferIndex = scope.carouselIndex*1 - bufferEdgeSize;
}

scope.carouselBufferIndex = bufferIndex;
Expand Down
Loading