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

Remove Buffered Transitions array #6367

Closed
wants to merge 1 commit into from
Closed
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
25 changes: 1 addition & 24 deletions src/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ angular.module('ui.bootstrap.carousel', [])
slides = self.slides = $scope.slides = [],
SLIDE_DIRECTION = 'uib-slideDirection',
currentIndex = $scope.active,
currentInterval, isPlaying, bufferedTransitions = [];
currentInterval, isPlaying;

var destroyed = false;
$element.addClass('carousel');
Expand Down Expand Up @@ -67,11 +67,6 @@ angular.module('ui.bootstrap.carousel', [])
self.removeSlide = function(slide) {
var index = findSlideIndex(slide);

var bufferedIndex = bufferedTransitions.indexOf(slides[index]);
if (bufferedIndex !== -1) {
bufferedTransitions.splice(bufferedIndex, 1);
}

//get the index of the slide inside the carousel
slides.splice(index, 1);
if (slides.length > 0 && currentIndex === index) {
Expand All @@ -95,7 +90,6 @@ angular.module('ui.bootstrap.carousel', [])
if (slides.length === 0) {
currentIndex = null;
$scope.active = null;
clearBufferedTransitions();
}
};

Expand All @@ -110,8 +104,6 @@ angular.module('ui.bootstrap.carousel', [])
if (nextSlide.slide.index !== currentIndex &&
!$scope.$currentTransition) {
goNext(nextSlide.slide, nextIndex, direction);
} else if (nextSlide && nextSlide.slide.index !== currentIndex && $scope.$currentTransition) {
bufferedTransitions.push(slides[nextIndex]);
}
};

Expand Down Expand Up @@ -180,12 +172,6 @@ angular.module('ui.bootstrap.carousel', [])
}
});

function clearBufferedTransitions() {
while (bufferedTransitions.length) {
bufferedTransitions.shift();
}
}

function getSlideByIndex(index) {
for (var i = 0, l = slides.length; i < l; ++i) {
if (slides[i].index === index) {
Expand Down Expand Up @@ -221,14 +207,6 @@ angular.module('ui.bootstrap.carousel', [])
if (phase === 'close') {
$scope.$currentTransition = null;
$animate.off('addClass', element);
if (bufferedTransitions.length) {
var nextSlide = bufferedTransitions.pop().slide;
var nextIndex = nextSlide.index;
var nextDirection = nextIndex > self.getCurrentIndex() ? 'next' : 'prev';
clearBufferedTransitions();

goNext(nextSlide, nextIndex, nextDirection);
}
}
});
}
Expand Down Expand Up @@ -259,7 +237,6 @@ angular.module('ui.bootstrap.carousel', [])
function resetTransition(slides) {
if (!slides.length) {
$scope.$currentTransition = null;
clearBufferedTransitions();
}
}

Expand Down