angular-carousel
angular-carousel copied to clipboard
rn-carousel-locked is not fully implemented
rn-carousel-locked="true" doesn't work for me, partly due to the way i'm using this carousel. (Really all I want to do is disable swiping)
Regardless of how I'm using the carousel, there are still several bugs: *1) Changing the slide is still possible using the controls, because: scope.nextSlide() and scope.prevSlide() are inconsistent. Only nextSlide() checks the 'locked' variable. *2) Changing the slide is still possible by changing the value of rn-carousel-index. *3) Navigating to another slide (via *2) will set 'locked' to false. iAttributes.rnCarouselLocked is then ignored because it's only checked once, and that's not enough.
I suggest creating a function like so:
function isLocked() {
return locked || iAttributes.rnCarouselLocked;
}
and change all instances of if(locked)
to if(isLocked())
.
Once that's done, you can remove this code:
if (iAttributes.rnCarouselLocked) {
scope.$watch(iAttributes.rnCarouselLocked, function(newValue, oldValue) {
// only bind swipe when it's not switched off
if(newValue === true) {
locked = true;
} else {
locked = false;
}
});
}
Also, please re-add an attribute to allow us to disable swiping and add if(isLocked())return;
to the beginning of the swipeStart method (actually, it should be something like if(isLocked() || isSwipingDisabled)return;
.
:+1: Just want to disable swipe as well. That would be a great feature.
I am just trying to disable swipe also, @wbyoko did you find a fix?
Not at that point. I hid controls in situations but swipe was still available.
Does seem like functionality that should be there.
is there a solution for this?