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
51cd1bfb
Commit
51cd1bfb
authored
Nov 12, 2015
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix when floor is negative and ceil is 0
As reported in #174
parent
d03ac54c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
5 deletions
+5
-5
rzslider.js
dist/rzslider.js
+1
-1
rzslider.min.css
dist/rzslider.min.css
+1
-1
rzslider.min.js
dist/rzslider.min.js
+2
-2
rzslider.js
src/rzslider.js
+1
-1
No files found.
dist/rzslider.js
View file @
51cd1bfb
...
...
@@ -585,7 +585,7 @@
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
);
if
(
this
.
options
.
ceil
)
if
(
this
.
options
.
ceil
!=
null
)
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
);
else
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
;
...
...
dist/rzslider.min.css
View file @
51cd1bfb
/*! angularjs-slider - v2.0.0 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2015-11-1
1
*/
/*! angularjs-slider - v2.0.0 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2015-11-1
2
*/
rzslider
{
position
:
relative
;
display
:
inline-block
;
width
:
100%
;
height
:
4px
;
margin
:
35px
0
15px
0
;
vertical-align
:
middle
;
-webkit-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
user-select
:
none
}
rzslider
[
disabled
]
{
cursor
:
not-allowed
}
rzslider
[
disabled
]
.rz-pointer
{
cursor
:
not-allowed
;
background-color
:
#d8e0f3
}
rzslider
span
{
position
:
absolute
;
display
:
inline-block
;
white-space
:
nowrap
}
rzslider
.rz-base
{
width
:
100%
;
height
:
100%
;
padding
:
0
}
rzslider
.rz-bar-wrapper
{
left
:
0
;
z-index
:
1
;
width
:
100%
;
height
:
32px
;
padding-top
:
16px
;
margin-top
:
-16px
;
box-sizing
:
border-box
}
rzslider
.rz-bar-wrapper.rz-draggable
{
cursor
:
move
}
rzslider
.rz-bar
{
left
:
0
;
z-index
:
1
;
width
:
100%
;
height
:
4px
;
background
:
#d8e0f3
;
-webkit-border-radius
:
2px
;
-moz-border-radius
:
2px
;
border-radius
:
2px
}
rzslider
.rz-bar.rz-selection
{
z-index
:
2
;
background
:
#0db9f0
;
-webkit-border-radius
:
2px
;
-moz-border-radius
:
2px
;
border-radius
:
2px
}
rzslider
.rz-pointer
{
top
:
-14px
;
z-index
:
3
;
width
:
32px
;
height
:
32px
;
cursor
:
pointer
;
background-color
:
#0db9f0
;
-webkit-border-radius
:
16px
;
-moz-border-radius
:
16px
;
border-radius
:
16px
}
rzslider
.rz-pointer
:after
{
position
:
absolute
;
top
:
12px
;
left
:
12px
;
width
:
8px
;
height
:
8px
;
background
:
#fff
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
content
:
''
}
rzslider
.rz-pointer
:hover:after
{
background-color
:
#fff
}
rzslider
.rz-pointer.rz-active
:after
{
background-color
:
#451aff
}
rzslider
.rz-bubble
{
bottom
:
16px
;
padding
:
1px
3px
;
color
:
#55637d
;
cursor
:
default
}
rzslider
.rz-bubble.rz-selection
{
top
:
16px
}
rzslider
.rz-bubble.rz-limit
{
color
:
#55637d
}
rzslider
.rz-ticks
{
position
:
absolute
;
top
:
-3px
;
left
:
0
;
z-index
:
1
;
display
:
flex
;
width
:
100%
;
padding
:
0
11px
;
margin
:
0
;
list-style
:
none
;
box-sizing
:
border-box
;
justify-content
:
space-between
}
rzslider
.rz-ticks
.tick
{
width
:
10px
;
height
:
10px
;
text-align
:
center
;
cursor
:
pointer
;
background
:
#d8e0f3
;
border-radius
:
50%
}
rzslider
.rz-ticks
.tick.selected
{
background
:
#0db9f0
}
rzslider
.rz-ticks
.tick
.tick-value
{
position
:
absolute
;
top
:
-30px
;
transform
:
translate
(
-50%
,
0
)}
\ No newline at end of file
dist/rzslider.min.js
View file @
51cd1bfb
/*! angularjs-slider - v2.0.0 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2015-11-11 */
!
function
(
a
,
b
){
"use strict"
;
"function"
==
typeof
define
&&
define
.
amd
?
define
([
"angular"
],
b
):
"object"
==
typeof
module
&&
module
.
exports
?
module
.
exports
=
b
(
require
(
"angular"
)):
b
(
a
.
angular
)}(
this
,
function
(
a
){
"use strict"
;
var
b
=
a
.
module
(
"rzModule"
,[]).
factory
(
"RzSliderOptions"
,
function
(){
var
b
=
{
floor
:
0
,
ceil
:
null
,
step
:
1
,
precision
:
0
,
id
:
null
,
translate
:
null
,
stepsArray
:
null
,
draggableRange
:
!
1
,
showSelectionBar
:
!
1
,
hideLimitLabels
:
!
1
,
readOnly
:
!
1
,
disabled
:
!
1
,
interval
:
350
,
showTicks
:
!
1
,
showTicksValues
:
!
1
,
ticksValuesTooltip
:
null
,
scale
:
1
,
onStart
:
null
,
onChange
:
null
,
onEnd
:
null
},
c
=
{},
d
=
{};
return
d
.
options
=
function
(
b
){
a
.
extend
(
c
,
b
)},
d
.
getOptions
=
function
(
d
){
return
a
.
extend
({},
b
,
c
,
d
)},
d
}).
value
(
"rzThrottle"
,
function
(
a
,
b
,
c
){
var
d
,
e
,
f
,
g
=
Date
.
now
||
function
(){
return
(
new
Date
).
getTime
()},
h
=
null
,
i
=
0
;
c
=
c
||
{};
var
j
=
function
(){
i
=
c
.
leading
===!
1
?
0
:
g
(),
h
=
null
,
f
=
a
.
apply
(
d
,
e
),
d
=
e
=
null
};
return
function
(){
var
k
=
g
();
i
||
c
.
leading
!==!
1
||
(
i
=
k
);
var
l
=
b
-
(
k
-
i
);
return
d
=
this
,
e
=
arguments
,
0
>=
l
?(
clearTimeout
(
h
),
h
=
null
,
i
=
k
,
f
=
a
.
apply
(
d
,
e
),
d
=
e
=
null
):
h
||
c
.
trailing
===!
1
||
(
h
=
setTimeout
(
j
,
l
)),
f
}}).
factory
(
"RzSlider"
,[
"$timeout"
,
"$document"
,
"$window"
,
"$compile"
,
"RzSliderOptions"
,
"rzThrottle"
,
function
(
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
function
(
a
,
b
){
this
.
scope
=
a
,
this
.
sliderElem
=
b
,
this
.
range
=
void
0
!==
this
.
scope
.
rzSliderModel
&&
void
0
!==
this
.
scope
.
rzSliderHigh
,
this
.
dragging
=
{
active
:
!
1
,
value
:
0
,
difference
:
0
,
offset
:
0
,
lowDist
:
0
,
highDist
:
0
},
this
.
handleHalfWidth
=
0
,
this
.
maxLeft
=
0
,
this
.
precision
=
0
,
this
.
step
=
0
,
this
.
tracking
=
""
,
this
.
minValue
=
0
,
this
.
maxValue
=
0
,
this
.
valueRange
=
0
,
this
.
initHasRun
=!
1
,
this
.
fullBar
=
null
,
this
.
selBar
=
null
,
this
.
minH
=
null
,
this
.
maxH
=
null
,
this
.
flrLab
=
null
,
this
.
ceilLab
=
null
,
this
.
minLab
=
null
,
this
.
maxLab
=
null
,
this
.
cmbLab
=
null
,
this
.
ticks
=
null
,
this
.
init
()};
return
h
.
prototype
=
{
init
:
function
(){
var
c
,
e
,
f
=
a
.
bind
(
this
,
this
.
calcViewDimensions
),
h
=
this
;
this
.
applyOptions
(),
this
.
initElemHandles
(),
this
.
manageElementsStyle
(),
this
.
addAccessibility
(),
this
.
manageEventsBindings
(),
this
.
setDisabledState
(),
this
.
calcViewDimensions
(),
this
.
setMinAndMax
(),
b
(
function
(){
h
.
updateCeilLab
(),
h
.
updateFloorLab
(),
h
.
initHandles
(),
h
.
bindEvents
()}),
this
.
scope
.
$on
(
"reCalcViewDimensions"
,
f
),
a
.
element
(
d
).
on
(
"resize"
,
f
),
this
.
initHasRun
=!
0
,
c
=
g
(
function
(){
h
.
setMinAndMax
(),
h
.
updateLowHandle
(
h
.
valueToOffset
(
h
.
scope
.
rzSliderModel
)),
h
.
updateSelectionBar
(),
h
.
updateTicksScale
(),
h
.
range
&&
h
.
updateCmbLabel
()},
h
.
options
.
interval
),
e
=
g
(
function
(){
h
.
setMinAndMax
(),
h
.
updateHighHandle
(
h
.
valueToOffset
(
h
.
scope
.
rzSliderHigh
)),
h
.
updateSelectionBar
(),
h
.
updateTicksScale
(),
h
.
updateCmbLabel
()},
h
.
options
.
interval
),
this
.
scope
.
$on
(
"rzSliderForceRender"
,
function
(){
h
.
resetLabelsValue
(),
c
(),
h
.
range
&&
e
(),
h
.
resetSlider
()}),
this
.
scope
.
$watch
(
"rzSliderModel"
,
function
(
a
,
b
){
a
!==
b
&&
c
()}),
this
.
scope
.
$watch
(
"rzSliderHigh"
,
function
(
a
,
b
){
a
!==
b
&&
(
null
!=
a
&&
e
(),(
h
.
range
&&
null
==
a
||!
h
.
range
&&
null
!=
a
)
&&
(
h
.
applyOptions
(),
h
.
resetSlider
()))}),
this
.
scope
.
$watch
(
"rzSliderOptions"
,
function
(
a
,
b
){
a
!==
b
&&
(
h
.
applyOptions
(),
h
.
resetSlider
())},
!
0
),
this
.
scope
.
$on
(
"$destroy"
,
function
(){
h
.
unbindEvents
(),
a
.
element
(
d
).
off
(
"resize"
,
f
)})},
applyOptions
:
function
(){
this
.
options
=
f
.
getOptions
(
this
.
scope
.
rzSliderOptions
),
this
.
options
.
step
<=
0
&&
(
this
.
options
.
step
=
1
),
this
.
range
=
void
0
!==
this
.
scope
.
rzSliderModel
&&
void
0
!==
this
.
scope
.
rzSliderHigh
,
this
.
options
.
draggableRange
=
this
.
range
&&
this
.
options
.
draggableRange
,
this
.
options
.
showTicks
=
this
.
options
.
showTicks
||
this
.
options
.
showTicksValues
,
this
.
options
.
stepsArray
?(
this
.
options
.
floor
=
0
,
this
.
options
.
ceil
=
this
.
options
.
stepsArray
.
length
-
1
,
this
.
options
.
step
=
1
,
this
.
customTrFn
=
function
(
a
){
return
this
.
options
.
stepsArray
[
a
]}):
this
.
options
.
translate
?
this
.
customTrFn
=
this
.
options
.
translate
:
this
.
customTrFn
=
function
(
a
){
return
String
(
a
)}},
resetSlider
:
function
(){
this
.
manageElementsStyle
(),
this
.
setMinAndMax
(),
this
.
updateCeilLab
(),
this
.
updateFloorLab
(),
this
.
unbindEvents
(),
this
.
manageEventsBindings
(),
this
.
setDisabledState
(),
this
.
calcViewDimensions
()},
initElemHandles
:
function
(){
a
.
forEach
(
this
.
sliderElem
.
children
(),
function
(
b
,
c
){
var
d
=
a
.
element
(
b
);
switch
(
c
){
case
0
:
this
.
fullBar
=
d
;
break
;
case
1
:
this
.
selBar
=
d
;
break
;
case
2
:
this
.
minH
=
d
;
break
;
case
3
:
this
.
maxH
=
d
;
break
;
case
4
:
this
.
flrLab
=
d
;
break
;
case
5
:
this
.
ceilLab
=
d
;
break
;
case
6
:
this
.
minLab
=
d
;
break
;
case
7
:
this
.
maxLab
=
d
;
break
;
case
8
:
this
.
cmbLab
=
d
;
break
;
case
9
:
this
.
ticks
=
d
}},
this
),
this
.
selBar
.
rzsl
=
0
,
this
.
minH
.
rzsl
=
0
,
this
.
maxH
.
rzsl
=
0
,
this
.
flrLab
.
rzsl
=
0
,
this
.
ceilLab
.
rzsl
=
0
,
this
.
minLab
.
rzsl
=
0
,
this
.
maxLab
.
rzsl
=
0
,
this
.
cmbLab
.
rzsl
=
0
},
manageElementsStyle
:
function
(){
this
.
range
?
this
.
maxH
.
css
(
"display"
,
null
):
this
.
maxH
.
css
(
"display"
,
"none"
),
this
.
alwaysHide
(
this
.
flrLab
,
this
.
options
.
showTicksValues
||
this
.
options
.
hideLimitLabels
),
this
.
alwaysHide
(
this
.
ceilLab
,
this
.
options
.
showTicksValues
||
this
.
options
.
hideLimitLabels
),
this
.
alwaysHide
(
this
.
minLab
,
this
.
options
.
showTicksValues
),
this
.
alwaysHide
(
this
.
maxLab
,
this
.
options
.
showTicksValues
||!
this
.
range
),
this
.
alwaysHide
(
this
.
cmbLab
,
this
.
options
.
showTicksValues
||!
this
.
range
),
this
.
alwaysHide
(
this
.
selBar
,
!
this
.
range
&&!
this
.
options
.
showSelectionBar
),
this
.
options
.
showTicks
||
this
.
ticks
.
html
(
""
),
this
.
options
.
draggableRange
?
this
.
selBar
.
addClass
(
"rz-draggable"
):
this
.
selBar
.
removeClass
(
"rz-draggable"
)},
alwaysHide
:
function
(
a
,
b
){
a
.
rzAlwaysHide
=
b
,
b
?
this
.
hideEl
(
a
):
this
.
showEl
(
a
)},
manageEventsBindings
:
function
(){
this
.
options
.
disabled
||
this
.
options
.
readOnly
?
this
.
unbindEvents
():
this
.
options
.
disabled
&&
this
.
options
.
readOnly
||
this
.
bindEvents
()},
setDisabledState
:
function
(){
this
.
options
.
disabled
?
this
.
sliderElem
.
attr
(
"disabled"
,
"disabled"
):
this
.
sliderElem
.
attr
(
"disabled"
,
null
)},
resetLabelsValue
:
function
(){
this
.
minLab
.
rzsv
=
void
0
,
this
.
maxLab
.
rzsv
=
void
0
},
initHandles
:
function
(){
this
.
updateLowHandle
(
this
.
valueToOffset
(
this
.
scope
.
rzSliderModel
)),
this
.
range
&&
this
.
updateHighHandle
(
this
.
valueToOffset
(
this
.
scope
.
rzSliderHigh
)),
this
.
updateSelectionBar
(),
this
.
range
&&
this
.
updateCmbLabel
(),
this
.
updateTicksScale
()},
translateFn
:
function
(
a
,
b
,
c
){
c
=
void
0
===
c
?
!
0
:
c
;
var
d
=
String
(
c
?
this
.
customTrFn
(
a
,
this
.
options
.
id
):
a
),
e
=!
1
;(
void
0
===
b
.
rzsv
||
b
.
rzsv
.
length
!==
d
.
length
||
b
.
rzsv
.
length
>
0
&&
0
===
b
.
rzsw
)
&&
(
e
=!
0
,
b
.
rzsv
=
d
),
b
.
text
(
d
),
e
&&
this
.
getWidth
(
b
)},
setMinAndMax
:
function
(){
this
.
step
=+
this
.
options
.
step
,
this
.
precision
=+
this
.
options
.
precision
,
this
.
scope
.
rzSliderModel
=
this
.
roundStep
(
this
.
scope
.
rzSliderModel
),
this
.
range
&&
(
this
.
scope
.
rzSliderHigh
=
this
.
roundStep
(
this
.
scope
.
rzSliderHigh
)),
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
),
this
.
options
.
ceil
?
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
):
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
,
this
.
valueRange
=
this
.
maxValue
-
this
.
minValue
},
addAccessibility
:
function
(){
this
.
sliderElem
.
attr
(
"role"
,
"slider"
)},
calcViewDimensions
:
function
(){
var
a
=
this
.
getWidth
(
this
.
minH
);
this
.
handleHalfWidth
=
a
/
2
,
this
.
barWidth
=
this
.
getWidth
(
this
.
fullBar
),
this
.
maxLeft
=
this
.
barWidth
-
a
,
this
.
getWidth
(
this
.
sliderElem
),
this
.
sliderElem
.
rzsl
=
this
.
sliderElem
[
0
].
getBoundingClientRect
().
left
,
this
.
initHasRun
&&
(
this
.
updateFloorLab
(),
this
.
updateCeilLab
(),
this
.
initHandles
())},
updateTicksScale
:
function
(){
if
(
this
.
options
.
showTicks
&&
this
.
step
){
for
(
var
a
=
""
,
b
=
Math
.
round
((
this
.
maxValue
-
this
.
minValue
)
/
this
.
step
)
+
1
,
c
=
0
;
b
>
c
;
c
++
){
var
d
=
this
.
roundStep
(
this
.
minValue
+
c
*
this
.
step
),
f
=
this
.
isTickSelected
(
d
)?
"selected"
:
""
;
if
(
a
+=
'<li class="tick '
+
f
+
'">'
,
this
.
options
.
showTicksValues
){
var
g
=
""
;
this
.
options
.
ticksValuesTooltip
&&
(
g
=
'uib-tooltip="'
+
this
.
options
.
ticksValuesTooltip
(
d
)
+
'"'
),
a
+=
"<span "
+
g
+
' class="tick-value">'
+
this
.
getDisplayValue
(
d
)
+
"</span>"
}
a
+=
"</li>"
}
this
.
ticks
.
html
(
a
),
this
.
options
.
ticksValuesTooltip
&&
e
(
this
.
ticks
.
contents
())(
this
.
scope
)}},
isTickSelected
:
function
(
a
){
return
!
this
.
range
&&
this
.
options
.
showSelectionBar
&&
a
<=
this
.
scope
.
rzSliderModel
?
!
0
:
this
.
range
&&
a
>=
this
.
scope
.
rzSliderModel
&&
a
<=
this
.
scope
.
rzSliderHigh
?
!
0
:
!
1
},
updateCeilLab
:
function
(){
this
.
translateFn
(
this
.
maxValue
,
this
.
ceilLab
),
this
.
setLeft
(
this
.
ceilLab
,
this
.
barWidth
-
this
.
ceilLab
.
rzsw
),
this
.
getWidth
(
this
.
ceilLab
)},
updateFloorLab
:
function
(){
this
.
translateFn
(
this
.
minValue
,
this
.
flrLab
),
this
.
getWidth
(
this
.
flrLab
)},
callOnStart
:
function
(){
if
(
this
.
options
.
onStart
){
var
a
=
this
;
b
(
function
(){
a
.
options
.
onStart
()})}},
callOnChange
:
function
(){
if
(
this
.
options
.
onChange
){
var
a
=
this
;
b
(
function
(){
a
.
options
.
onChange
()})}},
callOnEnd
:
function
(){
if
(
this
.
options
.
onEnd
){
var
a
=
this
;
b
(
function
(){
a
.
options
.
onEnd
()})}},
updateHandles
:
function
(
a
,
b
){
return
"rzSliderModel"
===
a
?(
this
.
updateLowHandle
(
b
),
this
.
updateSelectionBar
(),
this
.
updateTicksScale
(),
void
(
this
.
range
&&
this
.
updateCmbLabel
())):
"rzSliderHigh"
===
a
?(
this
.
updateHighHandle
(
b
),
this
.
updateSelectionBar
(),
this
.
updateTicksScale
(),
void
(
this
.
range
&&
this
.
updateCmbLabel
())):(
this
.
updateLowHandle
(
b
),
this
.
updateHighHandle
(
b
),
this
.
updateSelectionBar
(),
this
.
updateTicksScale
(),
void
this
.
updateCmbLabel
())},
updateLowHandle
:
function
(
a
){
this
.
setLeft
(
this
.
minH
,
a
),
this
.
translateFn
(
this
.
scope
.
rzSliderModel
,
this
.
minLab
),
this
.
setLeft
(
this
.
minLab
,
a
-
this
.
minLab
.
rzsw
/
2
+
this
.
handleHalfWidth
),
this
.
shFloorCeil
()},
updateHighHandle
:
function
(
a
){
this
.
setLeft
(
this
.
maxH
,
a
),
this
.
translateFn
(
this
.
scope
.
rzSliderHigh
,
this
.
maxLab
),
this
.
setLeft
(
this
.
maxLab
,
a
-
this
.
maxLab
.
rzsw
/
2
+
this
.
handleHalfWidth
),
this
.
shFloorCeil
()},
shFloorCeil
:
function
(){
var
a
=!
1
,
b
=!
1
;
this
.
minLab
.
rzsl
<=
this
.
flrLab
.
rzsl
+
this
.
flrLab
.
rzsw
+
5
?(
a
=!
0
,
this
.
hideEl
(
this
.
flrLab
)):(
a
=!
1
,
this
.
showEl
(
this
.
flrLab
)),
this
.
minLab
.
rzsl
+
this
.
minLab
.
rzsw
>=
this
.
ceilLab
.
rzsl
-
this
.
handleHalfWidth
-
10
?(
b
=!
0
,
this
.
hideEl
(
this
.
ceilLab
)):(
b
=!
1
,
this
.
showEl
(
this
.
ceilLab
)),
this
.
range
&&
(
this
.
maxLab
.
rzsl
+
this
.
maxLab
.
rzsw
>=
this
.
ceilLab
.
rzsl
-
10
?
this
.
hideEl
(
this
.
ceilLab
):
b
||
this
.
showEl
(
this
.
ceilLab
),
this
.
maxLab
.
rzsl
<=
this
.
flrLab
.
rzsl
+
this
.
flrLab
.
rzsw
+
this
.
handleHalfWidth
?
this
.
hideEl
(
this
.
flrLab
):
a
||
this
.
showEl
(
this
.
flrLab
))},
updateSelectionBar
:
function
(){
this
.
setWidth
(
this
.
selBar
,
Math
.
abs
(
this
.
maxH
.
rzsl
-
this
.
minH
.
rzsl
)
+
this
.
handleHalfWidth
),
this
.
setLeft
(
this
.
selBar
,
this
.
range
?
this
.
minH
.
rzsl
+
this
.
handleHalfWidth
:
0
)},
updateCmbLabel
:
function
(){
var
a
,
b
;
this
.
minLab
.
rzsl
+
this
.
minLab
.
rzsw
+
10
>=
this
.
maxLab
.
rzsl
?(
a
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderModel
),
b
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderHigh
),
this
.
translateFn
(
a
+
" - "
+
b
,
this
.
cmbLab
,
!
1
),
this
.
setLeft
(
this
.
cmbLab
,
this
.
selBar
.
rzsl
+
this
.
selBar
.
rzsw
/
2
-
this
.
cmbLab
.
rzsw
/
2
),
this
.
hideEl
(
this
.
minLab
),
this
.
hideEl
(
this
.
maxLab
),
this
.
showEl
(
this
.
cmbLab
)):(
this
.
showEl
(
this
.
maxLab
),
this
.
showEl
(
this
.
minLab
),
this
.
hideEl
(
this
.
cmbLab
))},
getDisplayValue
:
function
(
a
){
return
this
.
customTrFn
(
a
,
this
.
options
.
id
)},
roundStep
:
function
(
a
){
var
b
=
this
.
step
,
c
=+
((
a
-
this
.
minValue
)
%
b
).
toFixed
(
3
),
d
=
c
>
b
/
2
?
a
+
b
-
c
:
a
-
c
;
return
d
=
d
.
toFixed
(
this
.
precision
),
+
d
},
hideEl
:
function
(
a
){
return
a
.
css
({
opacity
:
0
})},
showEl
:
function
(
a
){
return
a
.
rzAlwaysHide
?
a
:
a
.
css
({
opacity
:
1
})},
setLeft
:
function
(
a
,
b
){
return
a
.
rzsl
=
b
,
a
.
css
({
left
:
b
+
"px"
}),
b
},
getWidth
:
function
(
a
){
var
b
=
a
[
0
].
getBoundingClientRect
();
return
a
.
rzsw
=
(
b
.
right
-
b
.
left
)
*
this
.
options
.
scale
,
a
.
rzsw
},
setWidth
:
function
(
a
,
b
){
return
a
.
rzsw
=
b
,
a
.
css
({
width
:
b
+
"px"
}),
b
},
valueToOffset
:
function
(
a
){
return
(
this
.
sanitizeOffsetValue
(
a
)
-
this
.
minValue
)
*
this
.
maxLeft
/
this
.
valueRange
||
0
},
sanitizeOffsetValue
:
function
(
a
){
return
Math
.
min
(
Math
.
max
(
a
,
this
.
minValue
),
this
.
maxValue
)},
offsetToValue
:
function
(
a
){
return
a
/
this
.
maxLeft
*
this
.
valueRange
+
this
.
minValue
},
getEventX
:
function
(
a
){
return
"clientX"
in
a
?
a
.
clientX
:
void
0
===
a
.
originalEvent
?
a
.
touches
[
0
].
clientX
:
a
.
originalEvent
.
touches
[
0
].
clientX
},
getNearestHandle
:
function
(
a
){
if
(
!
this
.
range
)
return
this
.
minH
;
var
b
=
(
this
.
getEventX
(
a
)
-
this
.
sliderElem
.
rzsl
-
this
.
handleHalfWidth
)
*
this
.
options
.
scale
;
return
Math
.
abs
(
b
-
this
.
minH
.
rzsl
)
<
Math
.
abs
(
b
-
this
.
maxH
.
rzsl
)?
this
.
minH
:
this
.
maxH
},
bindEvents
:
function
(){
if
(
!
this
.
options
.
readOnly
&&!
this
.
options
.
disabled
){
var
b
,
c
,
d
;
this
.
options
.
draggableRange
?(
b
=
"rzSliderDrag"
,
c
=
this
.
onDragStart
,
d
=
this
.
onDragMove
):(
b
=
"rzSliderModel"
,
c
=
this
.
onStart
,
d
=
this
.
onMove
),
this
.
minH
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
minH
,
"rzSliderModel"
)),
this
.
range
&&
this
.
maxH
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
maxH
,
"rzSliderHigh"
)),
this
.
fullBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
fullBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
fullBar
)),
this
.
selBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
c
,
null
,
b
)),
this
.
selBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
d
,
this
.
selBar
)),
this
.
ticks
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
ticks
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
)),
this
.
minH
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
minH
,
"rzSliderModel"
)),
this
.
range
&&
this
.
maxH
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
maxH
,
"rzSliderHigh"
)),
this
.
fullBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
fullBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
fullBar
)),
this
.
selBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
c
,
null
,
b
)),
this
.
selBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
d
,
this
.
selBar
)),
this
.
ticks
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
ticks
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
))}},
unbindEvents
:
function
(){
this
.
minH
.
off
(),
this
.
maxH
.
off
(),
this
.
fullBar
.
off
(),
this
.
selBar
.
off
(),
this
.
ticks
.
off
()},
onStart
:
function
(
b
,
d
,
e
){
var
f
,
g
,
h
=
this
.
getEventNames
(
e
);
e
.
stopPropagation
(),
e
.
preventDefault
(),
""
===
this
.
tracking
&&
(
this
.
calcViewDimensions
(),
b
?
this
.
tracking
=
d
:(
b
=
this
.
getNearestHandle
(
e
),
this
.
tracking
=
b
===
this
.
minH
?
"rzSliderModel"
:
"rzSliderHigh"
),
b
.
addClass
(
"rz-active"
),
f
=
a
.
bind
(
this
,
this
.
dragging
.
active
?
this
.
onDragMove
:
this
.
onMove
,
b
),
g
=
a
.
bind
(
this
,
this
.
onEnd
,
f
),
c
.
on
(
h
.
moveEvent
,
f
),
c
.
one
(
h
.
endEvent
,
g
),
this
.
callOnStart
())},
onMove
:
function
(
a
,
b
){
var
c
,
d
,
e
,
f
=
this
.
getEventX
(
b
);
if
(
c
=
this
.
sliderElem
.
rzsl
,
d
=
(
f
-
c
-
this
.
handleHalfWidth
)
*
this
.
options
.
scale
,
0
>=
d
){
if
(
0
===
a
.
rzsl
)
return
;
e
=
this
.
minValue
,
d
=
0
}
else
if
(
d
>=
this
.
maxLeft
){
if
(
a
.
rzsl
===
this
.
maxLeft
)
return
;
e
=
this
.
maxValue
,
d
=
this
.
maxLeft
}
else
e
=
this
.
offsetToValue
(
d
),
e
=
this
.
roundStep
(
e
),
d
=
this
.
valueToOffset
(
e
);
this
.
positionTrackingHandle
(
e
,
d
)},
onDragStart
:
function
(
a
,
b
,
c
){
var
d
=
this
.
getEventX
(
c
)
-
this
.
sliderElem
.
rzsl
-
this
.
handleHalfWidth
;
this
.
dragging
=
{
active
:
!
0
,
value
:
this
.
offsetToValue
(
d
),
difference
:
this
.
scope
.
rzSliderHigh
-
this
.
scope
.
rzSliderModel
,
offset
:
d
,
lowDist
:
d
-
this
.
minH
.
rzsl
,
highDist
:
this
.
maxH
.
rzsl
-
d
},
this
.
minH
.
addClass
(
"rz-active"
),
this
.
maxH
.
addClass
(
"rz-active"
),
this
.
onStart
(
a
,
b
,
c
)},
onDragMove
:
function
(
a
,
b
){
var
c
,
d
,
e
,
f
,
g
=
this
.
getEventX
(
b
)
-
this
.
sliderElem
.
rzsl
-
this
.
handleHalfWidth
;
if
(
g
<=
this
.
dragging
.
lowDist
){
if
(
a
.
rzsl
===
this
.
dragging
.
lowDist
)
return
;
e
=
this
.
minValue
,
c
=
0
,
f
=
this
.
minValue
+
this
.
dragging
.
difference
,
d
=
this
.
valueToOffset
(
f
)}
else
if
(
g
>=
this
.
maxLeft
-
this
.
dragging
.
highDist
){
if
(
a
.
rzsl
===
this
.
dragging
.
highDist
)
return
;
f
=
this
.
maxValue
,
d
=
this
.
maxLeft
,
e
=
this
.
maxValue
-
this
.
dragging
.
difference
,
c
=
this
.
valueToOffset
(
e
)}
else
e
=
this
.
offsetToValue
(
g
-
this
.
dragging
.
lowDist
),
e
=
this
.
roundStep
(
e
),
c
=
this
.
valueToOffset
(
e
),
f
=
e
+
this
.
dragging
.
difference
,
d
=
this
.
valueToOffset
(
f
);
this
.
positionTrackingBar
(
e
,
f
,
c
,
d
)},
positionTrackingBar
:
function
(
a
,
b
,
c
,
d
){
this
.
scope
.
rzSliderModel
=
a
,
this
.
scope
.
rzSliderHigh
=
b
,
this
.
updateHandles
(
"rzSliderModel"
,
c
),
this
.
updateHandles
(
"rzSliderHigh"
,
d
),
this
.
scope
.
$apply
(),
this
.
callOnChange
()},
positionTrackingHandle
:
function
(
a
,
b
){
this
.
range
&&
(
"rzSliderModel"
===
this
.
tracking
&&
a
>=
this
.
scope
.
rzSliderHigh
?(
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderHigh
,
this
.
updateHandles
(
this
.
tracking
,
this
.
maxH
.
rzsl
),
this
.
tracking
=
"rzSliderHigh"
,
this
.
minH
.
removeClass
(
"rz-active"
),
this
.
maxH
.
addClass
(
"rz-active"
),
this
.
scope
.
$apply
(),
this
.
callOnChange
()):
"rzSliderHigh"
===
this
.
tracking
&&
a
<=
this
.
scope
.
rzSliderModel
&&
(
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderModel
,
this
.
updateHandles
(
this
.
tracking
,
this
.
minH
.
rzsl
),
this
.
tracking
=
"rzSliderModel"
,
this
.
maxH
.
removeClass
(
"rz-active"
),
this
.
minH
.
addClass
(
"rz-active"
),
this
.
scope
.
$apply
(),
this
.
callOnChange
())),
this
.
scope
[
this
.
tracking
]
!==
a
&&
(
this
.
scope
[
this
.
tracking
]
=
a
,
this
.
updateHandles
(
this
.
tracking
,
b
),
this
.
scope
.
$apply
(),
this
.
callOnChange
())},
onEnd
:
function
(
a
,
b
){
var
d
=
this
.
getEventNames
(
b
).
moveEvent
;
this
.
minH
.
removeClass
(
"rz-active"
),
this
.
maxH
.
removeClass
(
"rz-active"
),
c
.
off
(
d
,
a
),
this
.
scope
.
$emit
(
"slideEnded"
),
this
.
tracking
=
""
,
this
.
dragging
.
active
=!
1
,
this
.
callOnEnd
()},
getEventNames
:
function
(
a
){
var
b
=
{
moveEvent
:
""
,
endEvent
:
""
};
return
a
.
touches
||
void
0
!==
a
.
originalEvent
&&
a
.
originalEvent
.
touches
?(
b
.
moveEvent
=
"touchmove"
,
b
.
endEvent
=
"touchend"
):(
b
.
moveEvent
=
"mousemove"
,
b
.
endEvent
=
"mouseup"
),
b
}},
h
}]).
directive
(
"rzslider"
,[
"RzSlider"
,
function
(
a
){
return
{
restrict
:
"E"
,
scope
:{
rzSliderModel
:
"=?"
,
rzSliderHigh
:
"=?"
,
rzSliderOptions
:
"=?"
,
rzSliderTplUrl
:
"@"
},
templateUrl
:
function
(
a
,
b
){
return
b
.
rzSliderTplUrl
||
"rzSliderTpl.html"
},
link
:
function
(
b
,
c
){
return
new
a
(
b
,
c
)}}}]);
return
b
.
run
([
"$templateCache"
,
function
(
a
){
a
.
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 class=rz-ticks></ul>'
)}]),
b
});
\ No newline at end of file
/*! angularjs-slider - v2.0.0 - (c) Rafal Zajac <rzajac@gmail.com>, Valentin Hervieu <valentin@hervieu.me>, Jussi Saarivirta <jusasi@gmail.com>, Angelin Sirbu <angelin.sirbu@gmail.com>, https://github.com/rzajac/angularjs-slider.git - 2015-11-12 */
!
function
(
a
,
b
){
"use strict"
;
"function"
==
typeof
define
&&
define
.
amd
?
define
([
"angular"
],
b
):
"object"
==
typeof
module
&&
module
.
exports
?
module
.
exports
=
b
(
require
(
"angular"
)):
b
(
a
.
angular
)}(
this
,
function
(
a
){
"use strict"
;
var
b
=
a
.
module
(
"rzModule"
,[]).
factory
(
"RzSliderOptions"
,
function
(){
var
b
=
{
floor
:
0
,
ceil
:
null
,
step
:
1
,
precision
:
0
,
id
:
null
,
translate
:
null
,
stepsArray
:
null
,
draggableRange
:
!
1
,
showSelectionBar
:
!
1
,
hideLimitLabels
:
!
1
,
readOnly
:
!
1
,
disabled
:
!
1
,
interval
:
350
,
showTicks
:
!
1
,
showTicksValues
:
!
1
,
ticksValuesTooltip
:
null
,
scale
:
1
,
onStart
:
null
,
onChange
:
null
,
onEnd
:
null
},
c
=
{},
d
=
{};
return
d
.
options
=
function
(
b
){
a
.
extend
(
c
,
b
)},
d
.
getOptions
=
function
(
d
){
return
a
.
extend
({},
b
,
c
,
d
)},
d
}).
value
(
"rzThrottle"
,
function
(
a
,
b
,
c
){
var
d
,
e
,
f
,
g
=
Date
.
now
||
function
(){
return
(
new
Date
).
getTime
()},
h
=
null
,
i
=
0
;
c
=
c
||
{};
var
j
=
function
(){
i
=
c
.
leading
===!
1
?
0
:
g
(),
h
=
null
,
f
=
a
.
apply
(
d
,
e
),
d
=
e
=
null
};
return
function
(){
var
k
=
g
();
i
||
c
.
leading
!==!
1
||
(
i
=
k
);
var
l
=
b
-
(
k
-
i
);
return
d
=
this
,
e
=
arguments
,
0
>=
l
?(
clearTimeout
(
h
),
h
=
null
,
i
=
k
,
f
=
a
.
apply
(
d
,
e
),
d
=
e
=
null
):
h
||
c
.
trailing
===!
1
||
(
h
=
setTimeout
(
j
,
l
)),
f
}}).
factory
(
"RzSlider"
,[
"$timeout"
,
"$document"
,
"$window"
,
"$compile"
,
"RzSliderOptions"
,
"rzThrottle"
,
function
(
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
function
(
a
,
b
){
this
.
scope
=
a
,
this
.
sliderElem
=
b
,
this
.
range
=
void
0
!==
this
.
scope
.
rzSliderModel
&&
void
0
!==
this
.
scope
.
rzSliderHigh
,
this
.
dragging
=
{
active
:
!
1
,
value
:
0
,
difference
:
0
,
offset
:
0
,
lowDist
:
0
,
highDist
:
0
},
this
.
handleHalfWidth
=
0
,
this
.
maxLeft
=
0
,
this
.
precision
=
0
,
this
.
step
=
0
,
this
.
tracking
=
""
,
this
.
minValue
=
0
,
this
.
maxValue
=
0
,
this
.
valueRange
=
0
,
this
.
initHasRun
=!
1
,
this
.
fullBar
=
null
,
this
.
selBar
=
null
,
this
.
minH
=
null
,
this
.
maxH
=
null
,
this
.
flrLab
=
null
,
this
.
ceilLab
=
null
,
this
.
minLab
=
null
,
this
.
maxLab
=
null
,
this
.
cmbLab
=
null
,
this
.
ticks
=
null
,
this
.
init
()};
return
h
.
prototype
=
{
init
:
function
(){
var
c
,
e
,
f
=
a
.
bind
(
this
,
this
.
calcViewDimensions
),
h
=
this
;
this
.
applyOptions
(),
this
.
initElemHandles
(),
this
.
manageElementsStyle
(),
this
.
addAccessibility
(),
this
.
manageEventsBindings
(),
this
.
setDisabledState
(),
this
.
calcViewDimensions
(),
this
.
setMinAndMax
(),
b
(
function
(){
h
.
updateCeilLab
(),
h
.
updateFloorLab
(),
h
.
initHandles
(),
h
.
bindEvents
()}),
this
.
scope
.
$on
(
"reCalcViewDimensions"
,
f
),
a
.
element
(
d
).
on
(
"resize"
,
f
),
this
.
initHasRun
=!
0
,
c
=
g
(
function
(){
h
.
setMinAndMax
(),
h
.
updateLowHandle
(
h
.
valueToOffset
(
h
.
scope
.
rzSliderModel
)),
h
.
updateSelectionBar
(),
h
.
updateTicksScale
(),
h
.
range
&&
h
.
updateCmbLabel
()},
h
.
options
.
interval
),
e
=
g
(
function
(){
h
.
setMinAndMax
(),
h
.
updateHighHandle
(
h
.
valueToOffset
(
h
.
scope
.
rzSliderHigh
)),
h
.
updateSelectionBar
(),
h
.
updateTicksScale
(),
h
.
updateCmbLabel
()},
h
.
options
.
interval
),
this
.
scope
.
$on
(
"rzSliderForceRender"
,
function
(){
h
.
resetLabelsValue
(),
c
(),
h
.
range
&&
e
(),
h
.
resetSlider
()}),
this
.
scope
.
$watch
(
"rzSliderModel"
,
function
(
a
,
b
){
a
!==
b
&&
c
()}),
this
.
scope
.
$watch
(
"rzSliderHigh"
,
function
(
a
,
b
){
a
!==
b
&&
(
null
!=
a
&&
e
(),(
h
.
range
&&
null
==
a
||!
h
.
range
&&
null
!=
a
)
&&
(
h
.
applyOptions
(),
h
.
resetSlider
()))}),
this
.
scope
.
$watch
(
"rzSliderOptions"
,
function
(
a
,
b
){
a
!==
b
&&
(
h
.
applyOptions
(),
h
.
resetSlider
())},
!
0
),
this
.
scope
.
$on
(
"$destroy"
,
function
(){
h
.
unbindEvents
(),
a
.
element
(
d
).
off
(
"resize"
,
f
)})},
applyOptions
:
function
(){
this
.
options
=
f
.
getOptions
(
this
.
scope
.
rzSliderOptions
),
this
.
options
.
step
<=
0
&&
(
this
.
options
.
step
=
1
),
this
.
range
=
void
0
!==
this
.
scope
.
rzSliderModel
&&
void
0
!==
this
.
scope
.
rzSliderHigh
,
this
.
options
.
draggableRange
=
this
.
range
&&
this
.
options
.
draggableRange
,
this
.
options
.
showTicks
=
this
.
options
.
showTicks
||
this
.
options
.
showTicksValues
,
this
.
options
.
stepsArray
?(
this
.
options
.
floor
=
0
,
this
.
options
.
ceil
=
this
.
options
.
stepsArray
.
length
-
1
,
this
.
options
.
step
=
1
,
this
.
customTrFn
=
function
(
a
){
return
this
.
options
.
stepsArray
[
a
]}):
this
.
options
.
translate
?
this
.
customTrFn
=
this
.
options
.
translate
:
this
.
customTrFn
=
function
(
a
){
return
String
(
a
)}},
resetSlider
:
function
(){
this
.
manageElementsStyle
(),
this
.
setMinAndMax
(),
this
.
updateCeilLab
(),
this
.
updateFloorLab
(),
this
.
unbindEvents
(),
this
.
manageEventsBindings
(),
this
.
setDisabledState
(),
this
.
calcViewDimensions
()},
initElemHandles
:
function
(){
a
.
forEach
(
this
.
sliderElem
.
children
(),
function
(
b
,
c
){
var
d
=
a
.
element
(
b
);
switch
(
c
){
case
0
:
this
.
fullBar
=
d
;
break
;
case
1
:
this
.
selBar
=
d
;
break
;
case
2
:
this
.
minH
=
d
;
break
;
case
3
:
this
.
maxH
=
d
;
break
;
case
4
:
this
.
flrLab
=
d
;
break
;
case
5
:
this
.
ceilLab
=
d
;
break
;
case
6
:
this
.
minLab
=
d
;
break
;
case
7
:
this
.
maxLab
=
d
;
break
;
case
8
:
this
.
cmbLab
=
d
;
break
;
case
9
:
this
.
ticks
=
d
}},
this
),
this
.
selBar
.
rzsl
=
0
,
this
.
minH
.
rzsl
=
0
,
this
.
maxH
.
rzsl
=
0
,
this
.
flrLab
.
rzsl
=
0
,
this
.
ceilLab
.
rzsl
=
0
,
this
.
minLab
.
rzsl
=
0
,
this
.
maxLab
.
rzsl
=
0
,
this
.
cmbLab
.
rzsl
=
0
},
manageElementsStyle
:
function
(){
this
.
range
?
this
.
maxH
.
css
(
"display"
,
null
):
this
.
maxH
.
css
(
"display"
,
"none"
),
this
.
alwaysHide
(
this
.
flrLab
,
this
.
options
.
showTicksValues
||
this
.
options
.
hideLimitLabels
),
this
.
alwaysHide
(
this
.
ceilLab
,
this
.
options
.
showTicksValues
||
this
.
options
.
hideLimitLabels
),
this
.
alwaysHide
(
this
.
minLab
,
this
.
options
.
showTicksValues
),
this
.
alwaysHide
(
this
.
maxLab
,
this
.
options
.
showTicksValues
||!
this
.
range
),
this
.
alwaysHide
(
this
.
cmbLab
,
this
.
options
.
showTicksValues
||!
this
.
range
),
this
.
alwaysHide
(
this
.
selBar
,
!
this
.
range
&&!
this
.
options
.
showSelectionBar
),
this
.
options
.
showTicks
||
this
.
ticks
.
html
(
""
),
this
.
options
.
draggableRange
?
this
.
selBar
.
addClass
(
"rz-draggable"
):
this
.
selBar
.
removeClass
(
"rz-draggable"
)},
alwaysHide
:
function
(
a
,
b
){
a
.
rzAlwaysHide
=
b
,
b
?
this
.
hideEl
(
a
):
this
.
showEl
(
a
)},
manageEventsBindings
:
function
(){
this
.
options
.
disabled
||
this
.
options
.
readOnly
?
this
.
unbindEvents
():
this
.
options
.
disabled
&&
this
.
options
.
readOnly
||
this
.
bindEvents
()},
setDisabledState
:
function
(){
this
.
options
.
disabled
?
this
.
sliderElem
.
attr
(
"disabled"
,
"disabled"
):
this
.
sliderElem
.
attr
(
"disabled"
,
null
)},
resetLabelsValue
:
function
(){
this
.
minLab
.
rzsv
=
void
0
,
this
.
maxLab
.
rzsv
=
void
0
},
initHandles
:
function
(){
this
.
updateLowHandle
(
this
.
valueToOffset
(
this
.
scope
.
rzSliderModel
)),
this
.
range
&&
this
.
updateHighHandle
(
this
.
valueToOffset
(
this
.
scope
.
rzSliderHigh
)),
this
.
updateSelectionBar
(),
this
.
range
&&
this
.
updateCmbLabel
(),
this
.
updateTicksScale
()},
translateFn
:
function
(
a
,
b
,
c
){
c
=
void
0
===
c
?
!
0
:
c
;
var
d
=
String
(
c
?
this
.
customTrFn
(
a
,
this
.
options
.
id
):
a
),
e
=!
1
;(
void
0
===
b
.
rzsv
||
b
.
rzsv
.
length
!==
d
.
length
||
b
.
rzsv
.
length
>
0
&&
0
===
b
.
rzsw
)
&&
(
e
=!
0
,
b
.
rzsv
=
d
),
b
.
text
(
d
),
e
&&
this
.
getWidth
(
b
)},
setMinAndMax
:
function
(){
this
.
step
=+
this
.
options
.
step
,
this
.
precision
=+
this
.
options
.
precision
,
this
.
scope
.
rzSliderModel
=
this
.
roundStep
(
this
.
scope
.
rzSliderModel
),
this
.
range
&&
(
this
.
scope
.
rzSliderHigh
=
this
.
roundStep
(
this
.
scope
.
rzSliderHigh
)),
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
),
null
!=
this
.
options
.
ceil
?
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
):
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
,
this
.
valueRange
=
this
.
maxValue
-
this
.
minValue
},
addAccessibility
:
function
(){
this
.
sliderElem
.
attr
(
"role"
,
"slider"
)},
calcViewDimensions
:
function
(){
var
a
=
this
.
getWidth
(
this
.
minH
);
this
.
handleHalfWidth
=
a
/
2
,
this
.
barWidth
=
this
.
getWidth
(
this
.
fullBar
),
this
.
maxLeft
=
this
.
barWidth
-
a
,
this
.
getWidth
(
this
.
sliderElem
),
this
.
sliderElem
.
rzsl
=
this
.
sliderElem
[
0
].
getBoundingClientRect
().
left
,
this
.
initHasRun
&&
(
this
.
updateFloorLab
(),
this
.
updateCeilLab
(),
this
.
initHandles
())},
updateTicksScale
:
function
(){
if
(
this
.
options
.
showTicks
&&
this
.
step
){
for
(
var
a
=
""
,
b
=
Math
.
round
((
this
.
maxValue
-
this
.
minValue
)
/
this
.
step
)
+
1
,
c
=
0
;
b
>
c
;
c
++
){
var
d
=
this
.
roundStep
(
this
.
minValue
+
c
*
this
.
step
),
f
=
this
.
isTickSelected
(
d
)?
"selected"
:
""
;
if
(
a
+=
'<li class="tick '
+
f
+
'">'
,
this
.
options
.
showTicksValues
){
var
g
=
""
;
this
.
options
.
ticksValuesTooltip
&&
(
g
=
'uib-tooltip="'
+
this
.
options
.
ticksValuesTooltip
(
d
)
+
'"'
),
a
+=
"<span "
+
g
+
' class="tick-value">'
+
this
.
getDisplayValue
(
d
)
+
"</span>"
}
a
+=
"</li>"
}
this
.
ticks
.
html
(
a
),
this
.
options
.
ticksValuesTooltip
&&
e
(
this
.
ticks
.
contents
())(
this
.
scope
)}},
isTickSelected
:
function
(
a
){
return
!
this
.
range
&&
this
.
options
.
showSelectionBar
&&
a
<=
this
.
scope
.
rzSliderModel
?
!
0
:
this
.
range
&&
a
>=
this
.
scope
.
rzSliderModel
&&
a
<=
this
.
scope
.
rzSliderHigh
?
!
0
:
!
1
},
updateCeilLab
:
function
(){
this
.
translateFn
(
this
.
maxValue
,
this
.
ceilLab
),
this
.
setLeft
(
this
.
ceilLab
,
this
.
barWidth
-
this
.
ceilLab
.
rzsw
),
this
.
getWidth
(
this
.
ceilLab
)},
updateFloorLab
:
function
(){
this
.
translateFn
(
this
.
minValue
,
this
.
flrLab
),
this
.
getWidth
(
this
.
flrLab
)},
callOnStart
:
function
(){
if
(
this
.
options
.
onStart
){
var
a
=
this
;
b
(
function
(){
a
.
options
.
onStart
()})}},
callOnChange
:
function
(){
if
(
this
.
options
.
onChange
){
var
a
=
this
;
b
(
function
(){
a
.
options
.
onChange
()})}},
callOnEnd
:
function
(){
if
(
this
.
options
.
onEnd
){
var
a
=
this
;
b
(
function
(){
a
.
options
.
onEnd
()})}},
updateHandles
:
function
(
a
,
b
){
return
"rzSliderModel"
===
a
?(
this
.
updateLowHandle
(
b
),
this
.
updateSelectionBar
(),
this
.
updateTicksScale
(),
void
(
this
.
range
&&
this
.
updateCmbLabel
())):
"rzSliderHigh"
===
a
?(
this
.
updateHighHandle
(
b
),
this
.
updateSelectionBar
(),
this
.
updateTicksScale
(),
void
(
this
.
range
&&
this
.
updateCmbLabel
())):(
this
.
updateLowHandle
(
b
),
this
.
updateHighHandle
(
b
),
this
.
updateSelectionBar
(),
this
.
updateTicksScale
(),
void
this
.
updateCmbLabel
())},
updateLowHandle
:
function
(
a
){
this
.
setLeft
(
this
.
minH
,
a
),
this
.
translateFn
(
this
.
scope
.
rzSliderModel
,
this
.
minLab
),
this
.
setLeft
(
this
.
minLab
,
a
-
this
.
minLab
.
rzsw
/
2
+
this
.
handleHalfWidth
),
this
.
shFloorCeil
()},
updateHighHandle
:
function
(
a
){
this
.
setLeft
(
this
.
maxH
,
a
),
this
.
translateFn
(
this
.
scope
.
rzSliderHigh
,
this
.
maxLab
),
this
.
setLeft
(
this
.
maxLab
,
a
-
this
.
maxLab
.
rzsw
/
2
+
this
.
handleHalfWidth
),
this
.
shFloorCeil
()},
shFloorCeil
:
function
(){
var
a
=!
1
,
b
=!
1
;
this
.
minLab
.
rzsl
<=
this
.
flrLab
.
rzsl
+
this
.
flrLab
.
rzsw
+
5
?(
a
=!
0
,
this
.
hideEl
(
this
.
flrLab
)):(
a
=!
1
,
this
.
showEl
(
this
.
flrLab
)),
this
.
minLab
.
rzsl
+
this
.
minLab
.
rzsw
>=
this
.
ceilLab
.
rzsl
-
this
.
handleHalfWidth
-
10
?(
b
=!
0
,
this
.
hideEl
(
this
.
ceilLab
)):(
b
=!
1
,
this
.
showEl
(
this
.
ceilLab
)),
this
.
range
&&
(
this
.
maxLab
.
rzsl
+
this
.
maxLab
.
rzsw
>=
this
.
ceilLab
.
rzsl
-
10
?
this
.
hideEl
(
this
.
ceilLab
):
b
||
this
.
showEl
(
this
.
ceilLab
),
this
.
maxLab
.
rzsl
<=
this
.
flrLab
.
rzsl
+
this
.
flrLab
.
rzsw
+
this
.
handleHalfWidth
?
this
.
hideEl
(
this
.
flrLab
):
a
||
this
.
showEl
(
this
.
flrLab
))},
updateSelectionBar
:
function
(){
this
.
setWidth
(
this
.
selBar
,
Math
.
abs
(
this
.
maxH
.
rzsl
-
this
.
minH
.
rzsl
)
+
this
.
handleHalfWidth
),
this
.
setLeft
(
this
.
selBar
,
this
.
range
?
this
.
minH
.
rzsl
+
this
.
handleHalfWidth
:
0
)},
updateCmbLabel
:
function
(){
var
a
,
b
;
this
.
minLab
.
rzsl
+
this
.
minLab
.
rzsw
+
10
>=
this
.
maxLab
.
rzsl
?(
a
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderModel
),
b
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderHigh
),
this
.
translateFn
(
a
+
" - "
+
b
,
this
.
cmbLab
,
!
1
),
this
.
setLeft
(
this
.
cmbLab
,
this
.
selBar
.
rzsl
+
this
.
selBar
.
rzsw
/
2
-
this
.
cmbLab
.
rzsw
/
2
),
this
.
hideEl
(
this
.
minLab
),
this
.
hideEl
(
this
.
maxLab
),
this
.
showEl
(
this
.
cmbLab
)):(
this
.
showEl
(
this
.
maxLab
),
this
.
showEl
(
this
.
minLab
),
this
.
hideEl
(
this
.
cmbLab
))},
getDisplayValue
:
function
(
a
){
return
this
.
customTrFn
(
a
,
this
.
options
.
id
)},
roundStep
:
function
(
a
){
var
b
=
this
.
step
,
c
=+
((
a
-
this
.
minValue
)
%
b
).
toFixed
(
3
),
d
=
c
>
b
/
2
?
a
+
b
-
c
:
a
-
c
;
return
d
=
d
.
toFixed
(
this
.
precision
),
+
d
},
hideEl
:
function
(
a
){
return
a
.
css
({
opacity
:
0
})},
showEl
:
function
(
a
){
return
a
.
rzAlwaysHide
?
a
:
a
.
css
({
opacity
:
1
})},
setLeft
:
function
(
a
,
b
){
return
a
.
rzsl
=
b
,
a
.
css
({
left
:
b
+
"px"
}),
b
},
getWidth
:
function
(
a
){
var
b
=
a
[
0
].
getBoundingClientRect
();
return
a
.
rzsw
=
(
b
.
right
-
b
.
left
)
*
this
.
options
.
scale
,
a
.
rzsw
},
setWidth
:
function
(
a
,
b
){
return
a
.
rzsw
=
b
,
a
.
css
({
width
:
b
+
"px"
}),
b
},
valueToOffset
:
function
(
a
){
return
(
this
.
sanitizeOffsetValue
(
a
)
-
this
.
minValue
)
*
this
.
maxLeft
/
this
.
valueRange
||
0
},
sanitizeOffsetValue
:
function
(
a
){
return
Math
.
min
(
Math
.
max
(
a
,
this
.
minValue
),
this
.
maxValue
)},
offsetToValue
:
function
(
a
){
return
a
/
this
.
maxLeft
*
this
.
valueRange
+
this
.
minValue
},
getEventX
:
function
(
a
){
return
"clientX"
in
a
?
a
.
clientX
:
void
0
===
a
.
originalEvent
?
a
.
touches
[
0
].
clientX
:
a
.
originalEvent
.
touches
[
0
].
clientX
},
getNearestHandle
:
function
(
a
){
if
(
!
this
.
range
)
return
this
.
minH
;
var
b
=
(
this
.
getEventX
(
a
)
-
this
.
sliderElem
.
rzsl
-
this
.
handleHalfWidth
)
*
this
.
options
.
scale
;
return
Math
.
abs
(
b
-
this
.
minH
.
rzsl
)
<
Math
.
abs
(
b
-
this
.
maxH
.
rzsl
)?
this
.
minH
:
this
.
maxH
},
bindEvents
:
function
(){
if
(
!
this
.
options
.
readOnly
&&!
this
.
options
.
disabled
){
var
b
,
c
,
d
;
this
.
options
.
draggableRange
?(
b
=
"rzSliderDrag"
,
c
=
this
.
onDragStart
,
d
=
this
.
onDragMove
):(
b
=
"rzSliderModel"
,
c
=
this
.
onStart
,
d
=
this
.
onMove
),
this
.
minH
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
minH
,
"rzSliderModel"
)),
this
.
range
&&
this
.
maxH
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
maxH
,
"rzSliderHigh"
)),
this
.
fullBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
fullBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
fullBar
)),
this
.
selBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
c
,
null
,
b
)),
this
.
selBar
.
on
(
"mousedown"
,
a
.
bind
(
this
,
d
,
this
.
selBar
)),
this
.
ticks
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
ticks
.
on
(
"mousedown"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
)),
this
.
minH
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
minH
,
"rzSliderModel"
)),
this
.
range
&&
this
.
maxH
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
this
.
maxH
,
"rzSliderHigh"
)),
this
.
fullBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
fullBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
fullBar
)),
this
.
selBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
c
,
null
,
b
)),
this
.
selBar
.
on
(
"touchstart"
,
a
.
bind
(
this
,
d
,
this
.
selBar
)),
this
.
ticks
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onStart
,
null
,
null
)),
this
.
ticks
.
on
(
"touchstart"
,
a
.
bind
(
this
,
this
.
onMove
,
this
.
ticks
))}},
unbindEvents
:
function
(){
this
.
minH
.
off
(),
this
.
maxH
.
off
(),
this
.
fullBar
.
off
(),
this
.
selBar
.
off
(),
this
.
ticks
.
off
()},
onStart
:
function
(
b
,
d
,
e
){
var
f
,
g
,
h
=
this
.
getEventNames
(
e
);
e
.
stopPropagation
(),
e
.
preventDefault
(),
""
===
this
.
tracking
&&
(
this
.
calcViewDimensions
(),
b
?
this
.
tracking
=
d
:(
b
=
this
.
getNearestHandle
(
e
),
this
.
tracking
=
b
===
this
.
minH
?
"rzSliderModel"
:
"rzSliderHigh"
),
b
.
addClass
(
"rz-active"
),
f
=
a
.
bind
(
this
,
this
.
dragging
.
active
?
this
.
onDragMove
:
this
.
onMove
,
b
),
g
=
a
.
bind
(
this
,
this
.
onEnd
,
f
),
c
.
on
(
h
.
moveEvent
,
f
),
c
.
one
(
h
.
endEvent
,
g
),
this
.
callOnStart
())},
onMove
:
function
(
a
,
b
){
var
c
,
d
,
e
,
f
=
this
.
getEventX
(
b
);
if
(
c
=
this
.
sliderElem
.
rzsl
,
d
=
(
f
-
c
-
this
.
handleHalfWidth
)
*
this
.
options
.
scale
,
0
>=
d
){
if
(
0
===
a
.
rzsl
)
return
;
e
=
this
.
minValue
,
d
=
0
}
else
if
(
d
>=
this
.
maxLeft
){
if
(
a
.
rzsl
===
this
.
maxLeft
)
return
;
e
=
this
.
maxValue
,
d
=
this
.
maxLeft
}
else
e
=
this
.
offsetToValue
(
d
),
e
=
this
.
roundStep
(
e
),
d
=
this
.
valueToOffset
(
e
);
this
.
positionTrackingHandle
(
e
,
d
)},
onDragStart
:
function
(
a
,
b
,
c
){
var
d
=
this
.
getEventX
(
c
)
-
this
.
sliderElem
.
rzsl
-
this
.
handleHalfWidth
;
this
.
dragging
=
{
active
:
!
0
,
value
:
this
.
offsetToValue
(
d
),
difference
:
this
.
scope
.
rzSliderHigh
-
this
.
scope
.
rzSliderModel
,
offset
:
d
,
lowDist
:
d
-
this
.
minH
.
rzsl
,
highDist
:
this
.
maxH
.
rzsl
-
d
},
this
.
minH
.
addClass
(
"rz-active"
),
this
.
maxH
.
addClass
(
"rz-active"
),
this
.
onStart
(
a
,
b
,
c
)},
onDragMove
:
function
(
a
,
b
){
var
c
,
d
,
e
,
f
,
g
=
this
.
getEventX
(
b
)
-
this
.
sliderElem
.
rzsl
-
this
.
handleHalfWidth
;
if
(
g
<=
this
.
dragging
.
lowDist
){
if
(
a
.
rzsl
===
this
.
dragging
.
lowDist
)
return
;
e
=
this
.
minValue
,
c
=
0
,
f
=
this
.
minValue
+
this
.
dragging
.
difference
,
d
=
this
.
valueToOffset
(
f
)}
else
if
(
g
>=
this
.
maxLeft
-
this
.
dragging
.
highDist
){
if
(
a
.
rzsl
===
this
.
dragging
.
highDist
)
return
;
f
=
this
.
maxValue
,
d
=
this
.
maxLeft
,
e
=
this
.
maxValue
-
this
.
dragging
.
difference
,
c
=
this
.
valueToOffset
(
e
)}
else
e
=
this
.
offsetToValue
(
g
-
this
.
dragging
.
lowDist
),
e
=
this
.
roundStep
(
e
),
c
=
this
.
valueToOffset
(
e
),
f
=
e
+
this
.
dragging
.
difference
,
d
=
this
.
valueToOffset
(
f
);
this
.
positionTrackingBar
(
e
,
f
,
c
,
d
)},
positionTrackingBar
:
function
(
a
,
b
,
c
,
d
){
this
.
scope
.
rzSliderModel
=
a
,
this
.
scope
.
rzSliderHigh
=
b
,
this
.
updateHandles
(
"rzSliderModel"
,
c
),
this
.
updateHandles
(
"rzSliderHigh"
,
d
),
this
.
scope
.
$apply
(),
this
.
callOnChange
()},
positionTrackingHandle
:
function
(
a
,
b
){
this
.
range
&&
(
"rzSliderModel"
===
this
.
tracking
&&
a
>=
this
.
scope
.
rzSliderHigh
?(
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderHigh
,
this
.
updateHandles
(
this
.
tracking
,
this
.
maxH
.
rzsl
),
this
.
tracking
=
"rzSliderHigh"
,
this
.
minH
.
removeClass
(
"rz-active"
),
this
.
maxH
.
addClass
(
"rz-active"
),
this
.
scope
.
$apply
(),
this
.
callOnChange
()):
"rzSliderHigh"
===
this
.
tracking
&&
a
<=
this
.
scope
.
rzSliderModel
&&
(
this
.
scope
[
this
.
tracking
]
=
this
.
scope
.
rzSliderModel
,
this
.
updateHandles
(
this
.
tracking
,
this
.
minH
.
rzsl
),
this
.
tracking
=
"rzSliderModel"
,
this
.
maxH
.
removeClass
(
"rz-active"
),
this
.
minH
.
addClass
(
"rz-active"
),
this
.
scope
.
$apply
(),
this
.
callOnChange
())),
this
.
scope
[
this
.
tracking
]
!==
a
&&
(
this
.
scope
[
this
.
tracking
]
=
a
,
this
.
updateHandles
(
this
.
tracking
,
b
),
this
.
scope
.
$apply
(),
this
.
callOnChange
())},
onEnd
:
function
(
a
,
b
){
var
d
=
this
.
getEventNames
(
b
).
moveEvent
;
this
.
minH
.
removeClass
(
"rz-active"
),
this
.
maxH
.
removeClass
(
"rz-active"
),
c
.
off
(
d
,
a
),
this
.
scope
.
$emit
(
"slideEnded"
),
this
.
tracking
=
""
,
this
.
dragging
.
active
=!
1
,
this
.
callOnEnd
()},
getEventNames
:
function
(
a
){
var
b
=
{
moveEvent
:
""
,
endEvent
:
""
};
return
a
.
touches
||
void
0
!==
a
.
originalEvent
&&
a
.
originalEvent
.
touches
?(
b
.
moveEvent
=
"touchmove"
,
b
.
endEvent
=
"touchend"
):(
b
.
moveEvent
=
"mousemove"
,
b
.
endEvent
=
"mouseup"
),
b
}},
h
}]).
directive
(
"rzslider"
,[
"RzSlider"
,
function
(
a
){
return
{
restrict
:
"E"
,
scope
:{
rzSliderModel
:
"=?"
,
rzSliderHigh
:
"=?"
,
rzSliderOptions
:
"=?"
,
rzSliderTplUrl
:
"@"
},
templateUrl
:
function
(
a
,
b
){
return
b
.
rzSliderTplUrl
||
"rzSliderTpl.html"
},
link
:
function
(
b
,
c
){
return
new
a
(
b
,
c
)}}}]);
return
b
.
run
([
"$templateCache"
,
function
(
a
){
a
.
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 class=rz-ticks></ul>'
)}]),
b
});
\ No newline at end of file
src/rzslider.js
View file @
51cd1bfb
...
...
@@ -585,7 +585,7 @@
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
);
if
(
this
.
options
.
ceil
)
if
(
this
.
options
.
ceil
!=
null
)
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
);
else
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
;
...
...
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