angular-carousel icon indicating copy to clipboard operation
angular-carousel copied to clipboard

rn-carousel-locked is not fully implemented

Open EoinGriffin-AI opened this issue 9 years ago • 4 comments

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;.

EoinGriffin-AI avatar Nov 21 '14 00:11 EoinGriffin-AI

:+1: Just want to disable swipe as well. That would be a great feature.

wbyoko avatar Nov 26 '14 15:11 wbyoko

I am just trying to disable swipe also, @wbyoko did you find a fix?

retallicka avatar Nov 06 '15 14:11 retallicka

Not at that point. I hid controls in situations but swipe was still available.

Does seem like functionality that should be there.

wbyoko avatar Nov 06 '15 17:11 wbyoko

is there a solution for this?

hernimen avatar Oct 10 '17 16:10 hernimen