Skip to content

Commit ab41d83

Browse files
committed
feat(ticks): Accept numbers for showTicks/showTicksValues
Thanks to this feature, you can display ticks at intermediate positions without setting a fixed step
1 parent 35b5046 commit ab41d83

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

dist/rzslider.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! angularjs-slider - v2.8.0 -
22
(c) Rafal Zajac <[email protected]>, Valentin Hervieu <[email protected]>, Jussi Saarivirta <[email protected]>, Angelin Sirbu <[email protected]> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-02-08 */
4+
2016-02-13 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -738,12 +738,13 @@
738738
*/
739739
updateTicksScale: function() {
740740
if (!this.options.showTicks) return;
741-
742-
var positions = '',
743-
ticksCount = Math.round((this.maxValue - this.minValue) / this.step) + 1;
741+
var step = this.step;
742+
if(angular.isNumber(this.options.showTicks))
743+
step = this.options.showTicks;
744+
var ticksCount = Math.round((this.maxValue - this.minValue) / step) + 1;
744745
this.scope.ticks = [];
745746
for (var i = 0; i < ticksCount; i++) {
746-
var value = this.roundStep(this.minValue + i * this.step);
747+
var value = this.roundStep(this.minValue + i * step);
747748
var tick = {
748749
selected: this.isTickSelected(value)
749750
};

0 commit comments

Comments
 (0)