Commit 39c2fd13 authored by Valentin Hervieu's avatar Valentin Hervieu

Fix ticks count when step is a float.

parent af766f4e
......@@ -669,9 +669,10 @@ function throttle(func, wait, options) {
if(!this.showTicks) return;
if(!this.step) return; //if step is 0, the following loop will be endless.
var positions = '';
for (var i = this.minValue; i <= this.maxValue; i += this.step) {
var selectedClass = this.isTickSelected(i) ? 'selected': false;
var positions = '',
ticksCount = Math.round((this.maxValue - this.minValue) / this.step) + 1;
for (var i = 0; i < ticksCount; i++) {
var selectedClass = this.isTickSelected(i) ? 'selected': '';
positions += '<li class="tick '+ selectedClass +'">';
if(this.showTicksValue)
positions += '<span class="tick-value">'+ this.getDisplayValue(i) +'</span>';
......
This diff is collapsed.
......@@ -669,8 +669,9 @@ function throttle(func, wait, options) {
if(!this.showTicks) return;
if(!this.step) return; //if step is 0, the following loop will be endless.
var positions = '';
for (var i = this.minValue; i <= this.maxValue; i += this.step) {
var positions = '',
ticksCount = Math.round((this.maxValue - this.minValue) / this.step) + 1;
for (var i = 0; i < ticksCount; i++) {
var selectedClass = this.isTickSelected(i) ? 'selected': '';
positions += '<li class="tick '+ selectedClass +'">';
if(this.showTicksValue)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment