JoshDSommer / nativescript-slides

A NativeScript plugin that is for Intro Tutorials, Image Carousels or any other slide functionality
Other
70 stars 32 forks source link

Long swipe is needed to change the slide #119

Closed vahidvdn closed 6 years ago

vahidvdn commented 6 years ago

To change the slide, you must swipe too long and it's really annoying. If you see some other slides, if you swipe just a little bit, the slider will be changed.

SlirigHorcrux commented 6 years ago

Change the slider function in the .js file if you need it to swipe a little bit

SlideContainer.prototype.applySwipe = function (pageWidth) { var _this = this; var previousDelta = -1; //hack to get around ios firing pan event after release var endingVelocity = 0; this.currentPanel.panel.on('pan', function (args) { if (args.state === gestures.GestureStateTypes.began) { previousDelta = 0; endingVelocity = 250; _this.triggerStartEvent(); } else if (args.state === gestures.GestureStateTypes.ended) { // if velocityScrolling is enabled then calculate the velocitty // swiping left to right.

        if (args.deltaX > (pageWidth / 10)) {   // <- This value you want to change to 10 maybe
            if (_this.hasPrevious) {
                _this.transitioning = true;
                _this.showLeftSlide(_this.currentPanel, args.deltaX, endingVelocity).then(function () {
                    _this.setupPanel(_this.currentPanel.left);
                    _this.triggerChangeEventLeftToRight();
                });
            }
            else {
                //We're at the start
                //Notify no more slides
                _this.triggerCancelEvent(cancellationReason.noPrevSlides);
            }
            return;
        }
        else if (args.deltaX < (-pageWidth / 10)) {
vahidvdn commented 6 years ago

Thanks @c13andka for the reply. I have seen this before. The main value is 3. But It's better to be as a parameter. And after installing the plugin, I see multiple js files (compiled files) in some folders with the following names: esm5 , esm2015, fesm5, fesm2015 etc. And don't know in which one I should make changes.

Note: I use nativescript-ngx-slides version.

SlirigHorcrux commented 6 years ago

make the change in everyone ^^ or make change in one and test, if it did not work test the next soon you will know what file you are using :D

vahidvdn commented 6 years ago

@c13andka Are you sure they won't change in each compilation?

JoshDSommer commented 6 years ago

@vahidvdn instead of making a change in your file system, feel free to open up a PR on the nativescript-ngx-slides project.

IMO it would be best if the default value remained the current value, but then users could overrided it via an input of [swipeSpeed] or something like that.

vahidvdn commented 6 years ago

Added to nativescript-ngx-slides repo.