Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
I
i20rzslider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jedife
i20rzslider
Commits
24c6bf0e
Commit
24c6bf0e
authored
Dec 09, 2015
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support getSelectionBarColor for ticks.
parent
e5f3ab8f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
34 deletions
+49
-34
demo.js
demo/demo.js
+0
-1
rzslider.js
dist/rzslider.js
+24
-13
rzslider.min.js
dist/rzslider.min.js
+1
-1
rzSliderTpl.html
src/rzSliderTpl.html
+1
-7
rzslider.js
src/rzslider.js
+23
-12
No files found.
demo/demo.js
View file @
24c6bf0e
...
@@ -25,7 +25,6 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
...
@@ -25,7 +25,6 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $modal) {
}
}
};
};
//Slider with selection bar
//Slider with selection bar
$scope
.
color_slider_bar
=
{
$scope
.
color_slider_bar
=
{
value
:
12
,
value
:
12
,
...
...
dist/rzslider.js
View file @
24c6bf0e
...
@@ -377,7 +377,6 @@
...
@@ -377,7 +377,6 @@
this
.
range
=
this
.
scope
.
rzSliderModel
!==
undefined
&&
this
.
scope
.
rzSliderHigh
!==
undefined
;
this
.
range
=
this
.
scope
.
rzSliderModel
!==
undefined
&&
this
.
scope
.
rzSliderHigh
!==
undefined
;
this
.
options
.
draggableRange
=
this
.
range
&&
this
.
options
.
draggableRange
;
this
.
options
.
draggableRange
=
this
.
range
&&
this
.
options
.
draggableRange
;
this
.
options
.
showTicks
=
this
.
options
.
showTicks
||
this
.
options
.
showTicksValues
;
this
.
options
.
showTicks
=
this
.
options
.
showTicks
||
this
.
options
.
showTicksValues
;
this
.
scope
.
showTicks
=
this
.
options
.
showTicks
;
//scope is used in the template
if
(
this
.
options
.
stepsArray
)
{
if
(
this
.
options
.
stepsArray
)
{
this
.
options
.
floor
=
0
;
this
.
options
.
floor
=
0
;
...
@@ -491,6 +490,9 @@
...
@@ -491,6 +490,9 @@
this
.
alwaysHide
(
this
.
cmbLab
,
this
.
options
.
showTicksValues
||
!
this
.
range
);
this
.
alwaysHide
(
this
.
cmbLab
,
this
.
options
.
showTicksValues
||
!
this
.
range
);
this
.
alwaysHide
(
this
.
selBar
,
!
this
.
range
&&
!
this
.
options
.
showSelectionBar
);
this
.
alwaysHide
(
this
.
selBar
,
!
this
.
range
&&
!
this
.
options
.
showSelectionBar
);
if
(
!
this
.
options
.
showTicks
)
this
.
ticks
.
html
(
''
);
if
(
this
.
options
.
draggableRange
)
if
(
this
.
options
.
draggableRange
)
this
.
selBar
.
addClass
(
'rz-draggable'
);
this
.
selBar
.
addClass
(
'rz-draggable'
);
else
else
...
@@ -657,25 +659,34 @@
...
@@ -657,25 +659,34 @@
*/
*/
updateTicksScale
:
function
()
{
updateTicksScale
:
function
()
{
if
(
!
this
.
options
.
showTicks
)
return
;
if
(
!
this
.
options
.
showTicks
)
return
;
if
(
!
this
.
step
)
return
;
//if step is 0,
we'll get a zero division
if
(
!
this
.
step
)
return
;
//if step is 0,
the following loop will be endless.
var
positions
=
''
,
var
positions
=
''
,
ticksCount
=
Math
.
round
((
this
.
maxValue
-
this
.
minValue
)
/
this
.
step
)
+
1
;
ticksCount
=
Math
.
round
((
this
.
maxValue
-
this
.
minValue
)
/
this
.
step
)
+
1
;
this
.
scope
.
ticks
=
[];
for
(
var
i
=
0
;
i
<
ticksCount
;
i
++
)
{
for
(
var
i
=
0
;
i
<
ticksCount
;
i
++
)
{
var
value
=
this
.
roundStep
(
this
.
minValue
+
i
*
this
.
step
);
var
value
=
this
.
roundStep
(
this
.
minValue
+
i
*
this
.
step
),
var
tick
=
{
selected
=
this
.
isTickSelected
(
value
),
selected
:
this
.
isTickSelected
(
value
)
selectedClass
=
selected
?
'selected'
:
''
,
};
customStyle
=
''
;
if
(
selected
&&
this
.
options
.
getSelectionBarColor
)
{
var
color
=
this
.
options
.
getSelectionBarColor
();
customStyle
=
'style="background-color: '
+
color
+
'"'
;
}
positions
+=
'<li class="tick '
+
selectedClass
+
'" '
+
customStyle
+
'>'
;
if
(
this
.
options
.
showTicksValues
)
{
if
(
this
.
options
.
showTicksValues
)
{
tick
.
value
=
this
.
getDisplayValue
(
value
)
;
var
tooltip
=
''
;
if
(
this
.
options
.
ticksValuesTooltip
)
{
if
(
this
.
options
.
ticksValuesTooltip
)
{
tick
.
tooltip
=
this
.
options
.
ticksValuesTooltip
(
value
);
tooltip
=
'uib-tooltip="'
+
this
.
options
.
ticksValuesTooltip
(
value
)
+
'"'
;
tick
.
tooltipPlacement
=
this
.
options
.
vertical
?
'right'
:
'top'
;
if
(
this
.
options
.
vertical
)
tooltip
+=
' tooltip-placement="right"'
}
}
positions
+=
'<span '
+
tooltip
+
' class="tick-value">'
+
this
.
getDisplayValue
(
value
)
+
'</span>'
;
}
}
this
.
scope
.
ticks
.
push
(
tick
)
;
positions
+=
'</li>'
;
}
}
this
.
ticks
.
html
(
positions
);
if
(
this
.
options
.
ticksValuesTooltip
)
$compile
(
this
.
ticks
.
contents
())(
this
.
scope
);
},
},
isTickSelected
:
function
(
value
)
{
isTickSelected
:
function
(
value
)
{
...
@@ -865,7 +876,7 @@
...
@@ -865,7 +876,7 @@
updateSelectionBar
:
function
()
{
updateSelectionBar
:
function
()
{
this
.
setDimension
(
this
.
selBar
,
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
)
+
this
.
handleHalfDim
);
this
.
setDimension
(
this
.
selBar
,
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
)
+
this
.
handleHalfDim
);
this
.
setPosition
(
this
.
selBar
,
this
.
range
?
this
.
minH
.
rzsp
+
this
.
handleHalfDim
:
0
);
this
.
setPosition
(
this
.
selBar
,
this
.
range
?
this
.
minH
.
rzsp
+
this
.
handleHalfDim
:
0
);
if
(
this
.
options
.
getSelectionBarColor
)
{
if
(
this
.
options
.
getSelectionBarColor
)
{
var
color
=
this
.
options
.
getSelectionBarColor
();
var
color
=
this
.
options
.
getSelectionBarColor
();
this
.
selBarChild
.
css
({
backgroundColor
:
color
});
this
.
selBarChild
.
css
({
backgroundColor
:
color
});
}
}
...
@@ -1434,7 +1445,7 @@
...
@@ -1434,7 +1445,7 @@
'use strict'
;
'use strict'
;
$templateCache
.
put
(
'rzSliderTpl.html'
,
$templateCache
.
put
(
'rzSliderTpl.html'
,
"<span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class=
\"
rz-bar rz-selection
\"
></span></span> <span class=rz-pointer></span> <span class=rz-pointer></span> <span class=
\"
rz-bubble rz-limit
\"
></span> <span class=
\"
rz-bubble rz-limit
\"
></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul
ng-show=showTicks class=rz-ticks><li ng-repeat=
\"
t in ticks
\"
class=tick ng-class=
\"
{selected: t.selected}
\"
><span ng-if=
\"
t.value != null && t.tooltip == null
\"
class=tick-value>{{ t.value }}</span> <span ng-if=
\"
t.value != null && t.tooltip != null
\"
class=tick-value uib-tooltip=
\"
{{ t.tooltip }}
\"
tooltip-placement={{t.tooltipPlacement}}>{{ t.value }}</span></li
></ul>"
"<span class=rz-bar-wrapper><span class=rz-bar></span></span> <span class=rz-bar-wrapper><span class=
\"
rz-bar rz-selection
\"
></span></span> <span class=rz-pointer></span> <span class=rz-pointer></span> <span class=
\"
rz-bubble rz-limit
\"
></span> <span class=
\"
rz-bubble rz-limit
\"
></span> <span class=rz-bubble></span> <span class=rz-bubble></span> <span class=rz-bubble></span><ul
class=rz-ticks
></ul>"
);
);
}]);
}]);
...
...
dist/rzslider.min.js
View file @
24c6bf0e
This diff is collapsed.
Click to expand it.
src/rzSliderTpl.html
View file @
24c6bf0e
...
@@ -7,10 +7,4 @@
...
@@ -7,10 +7,4 @@
<span
class=
"rz-bubble"
></span>
<!-- // 6 Label above left slider handle -->
<span
class=
"rz-bubble"
></span>
<!-- // 6 Label above left slider handle -->
<span
class=
"rz-bubble"
></span>
<!-- // 7 Label above right slider handle -->
<span
class=
"rz-bubble"
></span>
<!-- // 7 Label above right slider handle -->
<span
class=
"rz-bubble"
></span>
<!-- // 8 Range label when the slider handles are close ex. 15 - 17 -->
<span
class=
"rz-bubble"
></span>
<!-- // 8 Range label when the slider handles are close ex. 15 - 17 -->
<ul
ng-show=
"showTicks"
class=
"rz-ticks"
>
<!-- // 9 The ticks -->
<ul
class=
"rz-ticks"
></ul>
<!-- // 9 The ticks -->
<li
ng-repeat=
"t in ticks"
class=
"tick"
ng-class=
"{selected: t.selected}"
>
<span
ng-if=
"t.value != null && t.tooltip == null"
class=
"tick-value"
>
{{ t.value }}
</span>
<span
ng-if=
"t.value != null && t.tooltip != null"
class=
"tick-value"
uib-tooltip=
"{{ t.tooltip }}"
tooltip-placement=
"{{t.tooltipPlacement}}"
>
{{ t.value }}
</span>
</li>
</ul>
src/rzslider.js
View file @
24c6bf0e
...
@@ -377,7 +377,6 @@
...
@@ -377,7 +377,6 @@
this
.
range
=
this
.
scope
.
rzSliderModel
!==
undefined
&&
this
.
scope
.
rzSliderHigh
!==
undefined
;
this
.
range
=
this
.
scope
.
rzSliderModel
!==
undefined
&&
this
.
scope
.
rzSliderHigh
!==
undefined
;
this
.
options
.
draggableRange
=
this
.
range
&&
this
.
options
.
draggableRange
;
this
.
options
.
draggableRange
=
this
.
range
&&
this
.
options
.
draggableRange
;
this
.
options
.
showTicks
=
this
.
options
.
showTicks
||
this
.
options
.
showTicksValues
;
this
.
options
.
showTicks
=
this
.
options
.
showTicks
||
this
.
options
.
showTicksValues
;
this
.
scope
.
showTicks
=
this
.
options
.
showTicks
;
//scope is used in the template
if
(
this
.
options
.
stepsArray
)
{
if
(
this
.
options
.
stepsArray
)
{
this
.
options
.
floor
=
0
;
this
.
options
.
floor
=
0
;
...
@@ -491,6 +490,9 @@
...
@@ -491,6 +490,9 @@
this
.
alwaysHide
(
this
.
cmbLab
,
this
.
options
.
showTicksValues
||
!
this
.
range
);
this
.
alwaysHide
(
this
.
cmbLab
,
this
.
options
.
showTicksValues
||
!
this
.
range
);
this
.
alwaysHide
(
this
.
selBar
,
!
this
.
range
&&
!
this
.
options
.
showSelectionBar
);
this
.
alwaysHide
(
this
.
selBar
,
!
this
.
range
&&
!
this
.
options
.
showSelectionBar
);
if
(
!
this
.
options
.
showTicks
)
this
.
ticks
.
html
(
''
);
if
(
this
.
options
.
draggableRange
)
if
(
this
.
options
.
draggableRange
)
this
.
selBar
.
addClass
(
'rz-draggable'
);
this
.
selBar
.
addClass
(
'rz-draggable'
);
else
else
...
@@ -657,25 +659,34 @@
...
@@ -657,25 +659,34 @@
*/
*/
updateTicksScale
:
function
()
{
updateTicksScale
:
function
()
{
if
(
!
this
.
options
.
showTicks
)
return
;
if
(
!
this
.
options
.
showTicks
)
return
;
if
(
!
this
.
step
)
return
;
//if step is 0,
we'll get a zero division
if
(
!
this
.
step
)
return
;
//if step is 0,
the following loop will be endless.
var
positions
=
''
,
var
positions
=
''
,
ticksCount
=
Math
.
round
((
this
.
maxValue
-
this
.
minValue
)
/
this
.
step
)
+
1
;
ticksCount
=
Math
.
round
((
this
.
maxValue
-
this
.
minValue
)
/
this
.
step
)
+
1
;
this
.
scope
.
ticks
=
[];
for
(
var
i
=
0
;
i
<
ticksCount
;
i
++
)
{
for
(
var
i
=
0
;
i
<
ticksCount
;
i
++
)
{
var
value
=
this
.
roundStep
(
this
.
minValue
+
i
*
this
.
step
);
var
value
=
this
.
roundStep
(
this
.
minValue
+
i
*
this
.
step
),
var
tick
=
{
selected
=
this
.
isTickSelected
(
value
),
selected
:
this
.
isTickSelected
(
value
)
selectedClass
=
selected
?
'selected'
:
''
,
};
customStyle
=
''
;
if
(
selected
&&
this
.
options
.
getSelectionBarColor
)
{
var
color
=
this
.
options
.
getSelectionBarColor
();
customStyle
=
'style="background-color: '
+
color
+
'"'
;
}
positions
+=
'<li class="tick '
+
selectedClass
+
'" '
+
customStyle
+
'>'
;
if
(
this
.
options
.
showTicksValues
)
{
if
(
this
.
options
.
showTicksValues
)
{
tick
.
value
=
this
.
getDisplayValue
(
value
)
;
var
tooltip
=
''
;
if
(
this
.
options
.
ticksValuesTooltip
)
{
if
(
this
.
options
.
ticksValuesTooltip
)
{
tick
.
tooltip
=
this
.
options
.
ticksValuesTooltip
(
value
);
tooltip
=
'uib-tooltip="'
+
this
.
options
.
ticksValuesTooltip
(
value
)
+
'"'
;
tick
.
tooltipPlacement
=
this
.
options
.
vertical
?
'right'
:
'top'
;
if
(
this
.
options
.
vertical
)
tooltip
+=
' tooltip-placement="right"'
}
}
positions
+=
'<span '
+
tooltip
+
' class="tick-value">'
+
this
.
getDisplayValue
(
value
)
+
'</span>'
;
}
}
this
.
scope
.
ticks
.
push
(
tick
)
;
positions
+=
'</li>'
;
}
}
this
.
ticks
.
html
(
positions
);
if
(
this
.
options
.
ticksValuesTooltip
)
$compile
(
this
.
ticks
.
contents
())(
this
.
scope
);
},
},
isTickSelected
:
function
(
value
)
{
isTickSelected
:
function
(
value
)
{
...
@@ -865,7 +876,7 @@
...
@@ -865,7 +876,7 @@
updateSelectionBar
:
function
()
{
updateSelectionBar
:
function
()
{
this
.
setDimension
(
this
.
selBar
,
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
)
+
this
.
handleHalfDim
);
this
.
setDimension
(
this
.
selBar
,
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
)
+
this
.
handleHalfDim
);
this
.
setPosition
(
this
.
selBar
,
this
.
range
?
this
.
minH
.
rzsp
+
this
.
handleHalfDim
:
0
);
this
.
setPosition
(
this
.
selBar
,
this
.
range
?
this
.
minH
.
rzsp
+
this
.
handleHalfDim
:
0
);
if
(
this
.
options
.
getSelectionBarColor
)
{
if
(
this
.
options
.
getSelectionBarColor
)
{
var
color
=
this
.
options
.
getSelectionBarColor
();
var
color
=
this
.
options
.
getSelectionBarColor
();
this
.
selBarChild
.
css
({
backgroundColor
:
color
});
this
.
selBarChild
.
css
({
backgroundColor
:
color
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment