darul75 / angular-awesome-slider

:arrows_clockwise: Angular slider control directive
http://darul75.github.io/angular-awesome-slider/
MIT License
144 stars 63 forks source link

Big Scale Failure #34

Closed H4xX02z closed 9 years ago

H4xX02z commented 9 years ago

if you display a scale with lots of entries, the scale have not the equal size as the slider.

The problem is in this file ng-slider.js file in the generateScale method. if you round the result the scale wont be display correctly.


scope.generateScale = function(){
                        if( scope.options.scale && scope.options.scale.length > 0 ){
                            var str = "";
                            var s = scope.options.scale;

                            //var prc = Math.round((100/(s.length-1))*10)/10;
                                                        // just replace Math.round

                                                        var prc = (100/(s.length-1));
                            for( var i=0; i < s.length; i++ ){
                                str += '<span style="left: ' + i*prc + '%">' + ( s[i] != '|' ? '<ins>' + s[i] + '</ins>' : '' ) + '</span>';
                            }
                            return str;
                        } else return "";

                        return "";
                    };
darul75 commented 9 years ago

sure, nice fix