soundar24 / roundSlider

roundSlider - A free jQuery plugin
https://roundsliderui.com/
MIT License
264 stars 80 forks source link

Slider keeps moving after release on mobile #96

Closed truffolone closed 4 years ago

truffolone commented 5 years ago

Hi, I have the following issue with the plugin.

While the slider works like a charm on desktop, when I use it on mobile and I drag the slider till a value (for example 3.22), when I pull up the finger from the phone the value change a bit.

I don't know if thats a problem with the slider itself or not (I think it is not), but I would like to know if there is a way to avoid that little movement on finger release.

thank you.

soundar24 commented 5 years ago

@truffolone, I hope this may happens due to a small shake when we release the finger (I just guess).

Can you let me know the configurations that you used for the slider (I mean min, max, step and other), I will try to reproduce the same in my mobile. If possible, if you have any online demo link then you can share me.

truffolone commented 5 years ago

Hi, this is my configuration

`let listOfValues = [ 1.1, 1.2, 1.34, 1.44, 1.6, 1.8, 2.2, 2.4, 2.55, 3, 4, 5, 5.5, 6, 6.8, 7, 8, 9, 10, 10.66 ]; let onSlider = false;

    $("#slider").roundSlider({
        sliderType: "min-range",
        circleShape: "pie",
        startAngle: 315,
        min: 1,
        max: 10.66,
        step: 0.01,
        tooltipFormat: "tooltip2",
        value: 5.66,
        beforeCreate: "beforeCreate",
        lineCap: "round",
        width: 35,
        radius: "150",
        change: function (args) {
            let currValue = this.getValue();
            let closest = listOfValues.reduce(function(prev, curr) {
                return (Math.abs(curr - currValue) < Math.abs(prev - currValue) ? curr : prev);
            });

            onSlider = true;

            this.setValue(closest);

            onSlider = false;
        }
    });`

Ignore the first part I was in need of some forced values but I included it here since I want to give the complete consifuration I am using.

Anyway I think this is a problem that is not from the plugin itself but how the mobile hardware handles the finger moving away form the screen...

If you think this is the case we can clode the issue since is not an issue itself but just something I need to work around

soundar24 commented 5 years ago

yes, I hope we can't handle this in the plugin side. Actually if you want to force your user to select the predefined values only, then can you try the below approach?

https://jsbin.com/monufohobo/edit?html,js,output

truffolone commented 5 years ago

Hi, for the predefined values its a little more complicated than this, I need to force into those predefined values only if the user uses the slider but not if the number is written into the input manually. I edited the plugin itself on order to accomplish that but that's another story

soundar24 commented 5 years ago

Oh ok, that's fine

soundar24 commented 4 years ago

@truffolone I will close this, if you have any more questions then you can let me know.

One more suggestion is, in the current roundSlider version (1.4.1) you can see the svgMode which has more improvement with stable animation and more. You can just give a try:

https://jsbin.com/duqocuv/1/edit?html,js,output