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) { ...@@ -669,9 +669,10 @@ function throttle(func, wait, options) {
if(!this.showTicks) return; if(!this.showTicks) return;
if(!this.step) return; //if step is 0, the following loop will be endless. if(!this.step) return; //if step is 0, the following loop will be endless.
var positions = ''; var positions = '',
for (var i = this.minValue; i <= this.maxValue; i += this.step) { ticksCount = Math.round((this.maxValue - this.minValue) / this.step) + 1;
var selectedClass = this.isTickSelected(i) ? 'selected': false; for (var i = 0; i < ticksCount; i++) {
var selectedClass = this.isTickSelected(i) ? 'selected': '';
positions += '<li class="tick '+ selectedClass +'">'; positions += '<li class="tick '+ selectedClass +'">';
if(this.showTicksValue) if(this.showTicksValue)
positions += '<span class="tick-value">'+ this.getDisplayValue(i) +'</span>'; positions += '<span class="tick-value">'+ this.getDisplayValue(i) +'</span>';
......
This diff is collapsed.
...@@ -669,8 +669,9 @@ function throttle(func, wait, options) { ...@@ -669,8 +669,9 @@ function throttle(func, wait, options) {
if(!this.showTicks) return; if(!this.showTicks) return;
if(!this.step) return; //if step is 0, the following loop will be endless. if(!this.step) return; //if step is 0, the following loop will be endless.
var positions = ''; var positions = '',
for (var i = this.minValue; i <= this.maxValue; i += this.step) { ticksCount = Math.round((this.maxValue - this.minValue) / this.step) + 1;
for (var i = 0; i < ticksCount; i++) {
var selectedClass = this.isTickSelected(i) ? 'selected': ''; var selectedClass = this.isTickSelected(i) ? 'selected': '';
positions += '<li class="tick '+ selectedClass +'">'; positions += '<li class="tick '+ selectedClass +'">';
if(this.showTicksValue) 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