Skip to content

Commit b771e8a

Browse files
committed
5.6.0 release
1 parent dff0e6d commit b771e8a

File tree

6 files changed

+70
-57
lines changed

6 files changed

+70
-57
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-slider",
3-
"version": "5.5.1",
3+
"version": "5.6.0",
44
"homepage": "https://github.com/angular-slider/angularjs-slider",
55
"authors": [
66
"Rafal Zajac <rzajac@gmail.com>",

dist/rzslider.css

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/*! angularjs-slider - v5.5.1 -
1+
/*! angularjs-slider - v5.6.0 -
22
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-10-07 */
4+
2016-10-16 */
55
.rzslider {
66
position: relative;
77
display: inline-block;
@@ -130,23 +130,20 @@
130130
top: -3px;
131131
left: 0;
132132
z-index: 1;
133-
display: -webkit-flex;
134-
display: -ms-flexbox;
135-
display: flex;
136133
width: 100%;
137134
height: 0;
138-
padding: 0 11px;
139135
margin: 0;
140136
list-style: none;
141137
box-sizing: border-box;
142-
-webkit-justify-content: space-between;
143-
-ms-flex-pack: justify;
144-
justify-content: space-between;
145138
}
146139

147140
.rzslider .rz-ticks .rz-tick {
141+
position: absolute;
142+
top: 0;
143+
left: 0;
148144
width: 10px;
149145
height: 10px;
146+
margin-left: 11px;
150147
text-align: center;
151148
cursor: pointer;
152149
background: #d8e0f3;
@@ -173,7 +170,7 @@
173170

174171
.rzslider .rz-ticks.rz-ticks-values-under .rz-tick-value {
175172
top: initial;
176-
bottom: -40px;
173+
bottom: -32px;
177174
}
178175

179176
.rzslider.rz-vertical {
@@ -230,19 +227,17 @@
230227
z-index: 1;
231228
width: 0;
232229
height: 100%;
233-
padding: 11px 0;
234-
-webkit-flex-direction: column-reverse;
235-
-ms-flex-direction: column-reverse;
236-
flex-direction: column-reverse;
237230
}
238231

239232
.rzslider.rz-vertical .rz-ticks .rz-tick {
233+
margin-top: 11px;
234+
margin-left: auto;
240235
vertical-align: middle;
241236
}
242237

243238
.rzslider.rz-vertical .rz-ticks .rz-tick .rz-tick-value {
244239
top: initial;
245-
left: 22px;
240+
left: 24px;
246241
transform: translate(0, -28%);
247242
}
248243

@@ -255,7 +250,7 @@
255250
}
256251

257252
.rzslider.rz-vertical .rz-ticks.rz-ticks-values-under .rz-tick-value {
258-
right: 12px;
253+
right: 24px;
259254
bottom: initial;
260255
left: initial;
261256
}

dist/rzslider.js

Lines changed: 53 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/*! angularjs-slider - v5.5.1 -
1+
/*! angularjs-slider - v5.6.0 -
22
(c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com> -
33
https://github.com/angular-slider/angularjs-slider -
4-
2016-10-07 */
4+
2016-10-16 */
55
/*jslint unparam: true */
66
/*global angular: false, console: false, define, module */
77
(function(root, factory) {
@@ -54,6 +54,7 @@
5454
interval: 350,
5555
showTicks: false,
5656
showTicksValues: false,
57+
ticksArray: null,
5758
ticksTooltip: null,
5859
ticksValuesTooltip: null,
5960
vertical: false,
@@ -543,9 +544,9 @@
543544
this.options.draggableRange = true;
544545
}
545546

546-
this.options.showTicks = this.options.showTicks || this.options.showTicksValues;
547+
this.options.showTicks = this.options.showTicks || this.options.showTicksValues || !!this.options.ticksArray;
547548
this.scope.showTicks = this.options.showTicks; //scope is used in the template
548-
if (angular.isNumber(this.options.showTicks))
549+
if (angular.isNumber(this.options.showTicks) || this.options.ticksArray)
549550
this.intermediateTicks = true;
550551

551552
this.options.showSelectionBar = this.options.showSelectionBar || this.options.showSelectionBarEnd
@@ -929,6 +930,10 @@
929930
this.updateFloorLab();
930931
this.updateCeilLab();
931932
this.initHandles();
933+
var self = this;
934+
$timeout(function() {
935+
self.updateTicksScale();
936+
});
932937
}
933938
},
934939

@@ -939,48 +944,61 @@
939944
*/
940945
updateTicksScale: function() {
941946
if (!this.options.showTicks) return;
942-
var step = this.step;
943-
if (this.intermediateTicks)
944-
step = this.options.showTicks;
945-
var ticksCount = Math.round((this.maxValue - this.minValue) / step) + 1;
946-
this.scope.ticks = [];
947-
for (var i = 0; i < ticksCount; i++) {
948-
var value = this.roundStep(this.minValue + i * step);
947+
948+
var ticksArray = this.options.ticksArray || this.getTicksArray(),
949+
translate = this.options.vertical ? 'translateY' : 'translateX',
950+
self = this;
951+
952+
if(this.options.rightToLeft)
953+
ticksArray.reverse();
954+
955+
this.scope.ticks = ticksArray.map(function(value){
956+
var offset = self.valueToOffset(value);
957+
958+
if (self.options.vertical)
959+
offset = self.maxPos - offset;
960+
949961
var tick = {
950-
selected: this.isTickSelected(value)
962+
selected: self.isTickSelected(value),
963+
style: {
964+
transform: translate + '(' + offset + 'px)'
965+
}
951966
};
952-
if (tick.selected && this.options.getSelectionBarColor) {
953-
tick.style = {
954-
'background-color': this.getSelectionBarColor()
955-
};
967+
if (tick.selected && self.options.getSelectionBarColor) {
968+
tick.style['background-color'] = self.getSelectionBarColor();
956969
}
957-
if (!tick.selected && this.options.getTickColor) {
958-
tick.style = {
959-
'background-color': this.getTickColor(value)
960-
}
970+
if (!tick.selected && self.options.getTickColor) {
971+
tick.style['background-color'] = self.getTickColor(value);
961972
}
962-
if (this.options.ticksTooltip) {
963-
tick.tooltip = this.options.ticksTooltip(value);
964-
tick.tooltipPlacement = this.options.vertical ? 'right' : 'top';
973+
if (self.options.ticksTooltip) {
974+
tick.tooltip = self.options.ticksTooltip(value);
975+
tick.tooltipPlacement = self.options.vertical ? 'right' : 'top';
965976
}
966-
if (this.options.showTicksValues) {
967-
tick.value = this.getDisplayValue(value, 'tick-value');
968-
if (this.options.ticksValuesTooltip) {
969-
tick.valueTooltip = this.options.ticksValuesTooltip(value);
970-
tick.valueTooltipPlacement = this.options.vertical ? 'right' : 'top';
977+
if (self.options.showTicksValues) {
978+
tick.value = self.getDisplayValue(value, 'tick-value');
979+
if (self.options.ticksValuesTooltip) {
980+
tick.valueTooltip = self.options.ticksValuesTooltip(value);
981+
tick.valueTooltipPlacement = self.options.vertical ? 'right' : 'top';
971982
}
972983
}
973-
if (this.getLegend) {
974-
var legend = this.getLegend(value, this.options.id);
984+
if (self.getLegend) {
985+
var legend = self.getLegend(value, self.options.id);
975986
if (legend)
976987
tick.legend = legend;
977988
}
978-
if (!this.options.rightToLeft) {
979-
this.scope.ticks.push(tick);
980-
} else {
981-
this.scope.ticks.unshift(tick);
982-
}
989+
return tick;
990+
});
991+
},
992+
993+
getTicksArray: function() {
994+
var step = this.step,
995+
ticksArray = [];
996+
if (this.intermediateTicks)
997+
step = this.options.showTicks;
998+
for (var value = this.minValue; value <= this.maxValue; value += step) {
999+
ticksArray.push(value);
9831000
}
1001+
return ticksArray;
9841002
},
9851003

9861004
isTickSelected: function(value) {

dist/rzslider.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rzslider.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angularjs-slider",
3-
"version": "5.5.1",
3+
"version": "5.6.0",
44
"description": "AngularJS slider directive with no external dependencies. Mobile friendly!.",
55
"main": "dist/rzslider.js",
66
"repository": {

0 commit comments

Comments
 (0)