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
3ea789d6
Commit
3ea789d6
authored
Dec 11, 2013
by
Rafal Zajac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renames, documentation, cleanup
parent
d190fd0e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
91 deletions
+58
-91
rzslider.min.js
dist/rzslider.min.js
+1
-1
rzslider.js
rzslider.js
+57
-90
No files found.
dist/rzslider.min.js
View file @
3ea789d6
This diff is collapsed.
Click to expand it.
rzslider.js
View file @
3ea789d6
...
...
@@ -87,14 +87,14 @@ function throttle(func, wait, options) {
this
.
range
=
(
attributes
.
rzSliderModel
===
undefined
)
&&
((
attributes
.
rzSliderLow
!==
undefined
)
&&
(
attributes
.
rzSliderHigh
!==
undefined
));
/**
* Name of the low value
* Name of the low value
model
*
* @type {string}
*/
this
.
refLow
=
this
.
range
?
'rzSliderLow'
:
'rzSliderModel'
;
/**
* Name of the high value
* Name of the high value
model
*
* @type {string}
*/
...
...
@@ -129,14 +129,14 @@ function throttle(func, wait, options) {
this
.
maxOffset
=
0
;
/**
* Minimum value (floor)
* Minimum value (floor)
of the model
*
* @type {number}
*/
this
.
minValue
=
0
;
/**
* Maximum value (ceiling)
* Maximum value (ceiling)
of the model
*
* @type {number}
*/
...
...
@@ -196,12 +196,12 @@ function throttle(func, wait, options) {
this
.
selBar
=
null
;
// Highlight between two handles
this
.
minPtr
=
null
;
// Left slider handle
this
.
maxPtr
=
null
;
// Right slider handle
this
.
sel
Bub
=
null
;
// Range bubble
this
.
flr
Bu
b
=
null
;
// Floor label
this
.
ceil
Bu
b
=
null
;
// Ceiling label
this
.
low
Bu
b
=
null
;
// Label above the low value
this
.
high
Bu
b
=
null
;
// Label above the high value
this
.
cmb
Bu
b
=
null
;
// Combined label
this
.
sel
Lab
=
null
;
// Range label
this
.
flr
La
b
=
null
;
// Floor label
this
.
ceil
La
b
=
null
;
// Ceiling label
this
.
low
La
b
=
null
;
// Label above the low value
this
.
high
La
b
=
null
;
// Label above the high value
this
.
cmb
La
b
=
null
;
// Combined label
// Initialize slider
this
.
init
();
...
...
@@ -322,12 +322,12 @@ function throttle(func, wait, options) {
case
1
:
this
.
selBar
=
_elem
;
break
;
case
2
:
this
.
minPtr
=
_elem
;
break
;
case
3
:
this
.
maxPtr
=
_elem
;
break
;
case
4
:
this
.
sel
Bu
b
=
_elem
;
break
;
case
5
:
this
.
flr
Bu
b
=
_elem
;
break
;
case
6
:
this
.
ceil
Bu
b
=
_elem
;
break
;
case
7
:
this
.
low
Bu
b
=
_elem
;
break
;
case
8
:
this
.
high
Bu
b
=
_elem
;
break
;
case
9
:
this
.
cmb
Bu
b
=
_elem
;
break
;
case
4
:
this
.
sel
La
b
=
_elem
;
break
;
case
5
:
this
.
flr
La
b
=
_elem
;
break
;
case
6
:
this
.
ceil
La
b
=
_elem
;
break
;
case
7
:
this
.
low
La
b
=
_elem
;
break
;
case
8
:
this
.
high
La
b
=
_elem
;
break
;
case
9
:
this
.
cmb
La
b
=
_elem
;
break
;
}
},
this
);
...
...
@@ -335,11 +335,11 @@ function throttle(func, wait, options) {
// Remove stuff not needed in single slider
if
(
!
this
.
range
)
{
this
.
cmb
Bu
b
.
remove
();
this
.
high
Bu
b
.
remove
();
this
.
cmb
La
b
.
remove
();
this
.
high
La
b
.
remove
();
this
.
maxPtr
.
remove
();
this
.
selBar
.
remove
();
this
.
sel
Bu
b
.
remove
();
this
.
sel
La
b
.
remove
();
}
},
...
...
@@ -357,44 +357,7 @@ function throttle(func, wait, options) {
this
.
minOffset
=
0
;
this
.
maxOffset
=
this
.
barWidth
-
pointerWidth
;
this
.
offsetRange
=
this
.
maxOffset
-
this
.
minOffset
;
this
.
setLeft
(
this
.
ceilBub
,
this
.
barWidth
-
this
.
offsetWidth
(
this
.
ceilBub
));
},
/**
* Set positions of slider handles, labels and selection bar
*
* @returns {undefined}
*/
setPointers
:
function
()
{
var
minPtrOL
,
maxPtrOL
,
selBarOL
,
selBarWidth
;
this
.
lowValOffsetPerc
=
this
.
percentValue
(
this
.
scope
[
this
.
refLow
]);
// Set low value slider handle position
minPtrOL
=
this
.
setLeft
(
this
.
minPtr
,
this
.
percentToOffset
(
this
.
lowValOffsetPerc
));
// Set low value label position
this
.
setLeft
(
this
.
lowBub
,
minPtrOL
-
this
.
halfOffsetWidth
(
this
.
lowBub
)
+
this
.
ptrHalfWidth
);
if
(
this
.
range
)
{
this
.
highValOffsetPerc
=
this
.
percentValue
(
this
.
scope
[
this
.
refHigh
]);
// Set high value slider handle position
maxPtrOL
=
this
.
setLeft
(
this
.
maxPtr
,
this
.
percentToOffset
(
this
.
highValOffsetPerc
));
// Set high value slider handle label position
this
.
setLeft
(
this
.
highBub
,
maxPtrOL
-
(
this
.
halfOffsetWidth
(
this
.
highBub
))
+
this
.
ptrHalfWidth
);
// Set selection bar position
selBarOL
=
this
.
setLeft
(
this
.
selBar
,
minPtrOL
+
this
.
ptrHalfWidth
);
selBarWidth
=
this
.
percentToOffset
(
this
.
highValOffsetPerc
-
this
.
lowValOffsetPerc
);
this
.
selBar
.
css
({
width
:
selBarWidth
+
'px'
});
// Set combined label position
this
.
setLeft
(
this
.
cmbBub
,
selBarOL
+
selBarWidth
/
2
-
this
.
halfOffsetWidth
(
this
.
cmbBub
)
+
1
);
// Set range label position
this
.
setLeft
(
this
.
selBub
,
selBarOL
+
selBarWidth
/
2
-
this
.
halfOffsetWidth
(
this
.
selBub
)
+
1
);
this
.
scope
.
rzSliderDiff
=
this
.
roundStep
(
this
.
scope
[
this
.
refHigh
]
-
this
.
scope
[
this
.
refLow
]);
}
this
.
setLeft
(
this
.
ceilLab
,
this
.
barWidth
-
this
.
offsetWidth
(
this
.
ceilLab
));
},
/**
...
...
@@ -438,7 +401,7 @@ function throttle(func, wait, options) {
minPtrOL
=
this
.
setLeft
(
this
.
minPtr
,
this
.
percentToOffset
(
this
.
lowValOffsetPerc
));
// Set low value label position
this
.
setLeft
(
this
.
low
Bub
,
minPtrOL
-
this
.
halfOffsetWidth
(
this
.
lowBu
b
)
+
this
.
ptrHalfWidth
);
this
.
setLeft
(
this
.
low
Lab
,
minPtrOL
-
this
.
halfOffsetWidth
(
this
.
lowLa
b
)
+
this
.
ptrHalfWidth
);
},
/**
...
...
@@ -454,7 +417,7 @@ function throttle(func, wait, options) {
// Set high value slider handle position
maxPtrOL
=
this
.
setLeft
(
this
.
maxPtr
,
this
.
percentToOffset
(
this
.
highValOffsetPerc
));
// Set high value slider handle label position
this
.
setLeft
(
this
.
high
Bub
,
maxPtrOL
-
(
this
.
halfOffsetWidth
(
this
.
highBu
b
))
+
this
.
ptrHalfWidth
);
this
.
setLeft
(
this
.
high
Lab
,
maxPtrOL
-
(
this
.
halfOffsetWidth
(
this
.
highLa
b
))
+
this
.
ptrHalfWidth
);
},
/**
...
...
@@ -470,10 +433,10 @@ function throttle(func, wait, options) {
this
.
selBar
.
css
({
width
:
selBarWidth
+
'px'
});
// Set combined label position
this
.
setLeft
(
this
.
cmb
Bub
,
selBarOL
+
selBarWidth
/
2
-
this
.
halfOffsetWidth
(
this
.
cmbBu
b
)
+
1
);
this
.
setLeft
(
this
.
cmb
Lab
,
selBarOL
+
selBarWidth
/
2
-
this
.
halfOffsetWidth
(
this
.
cmbLa
b
)
+
1
);
// Set range label position
this
.
setLeft
(
this
.
sel
Bub
,
selBarOL
+
selBarWidth
/
2
-
this
.
halfOffsetWidth
(
this
.
selBu
b
)
+
1
);
this
.
setLeft
(
this
.
sel
Lab
,
selBarOL
+
selBarWidth
/
2
-
this
.
halfOffsetWidth
(
this
.
selLa
b
)
+
1
);
this
.
scope
.
rzSliderDiff
=
this
.
roundStep
(
this
.
scope
[
this
.
refHigh
]
-
this
.
scope
[
this
.
refLow
]);
},
...
...
@@ -482,80 +445,86 @@ function throttle(func, wait, options) {
*
* @returns {undefined}
*/
adjustLabels
:
function
()
adjustLabels
:
function
(
origin
)
{
// console.log('al', this.scope.$id + ' ' + arguments[0]);
var
bubToAdjust
=
this
.
high
Bu
b
;
var
bubToAdjust
=
this
.
high
La
b
;
this
.
fitToBar
(
this
.
low
Bu
b
);
this
.
fitToBar
(
this
.
low
La
b
);
if
(
this
.
range
)
{
this
.
fitToBar
(
this
.
high
Bu
b
);
this
.
fitToBar
(
this
.
sel
Bu
b
);
this
.
fitToBar
(
this
.
high
La
b
);
this
.
fitToBar
(
this
.
sel
La
b
);
if
(
this
.
gap
(
this
.
low
Bub
,
this
.
highBu
b
)
<
10
)
if
(
this
.
gap
(
this
.
low
Lab
,
this
.
highLa
b
)
<
10
)
{
this
.
hideEl
(
this
.
low
Bu
b
);
this
.
hideEl
(
this
.
high
Bu
b
);
this
.
fitToBar
(
this
.
cmb
Bu
b
);
this
.
showEl
(
this
.
cmb
Bu
b
);
bubToAdjust
=
this
.
cmb
Bu
b
;
this
.
hideEl
(
this
.
low
La
b
);
this
.
hideEl
(
this
.
high
La
b
);
this
.
fitToBar
(
this
.
cmb
La
b
);
this
.
showEl
(
this
.
cmb
La
b
);
bubToAdjust
=
this
.
cmb
La
b
;
}
else
{
this
.
showEl
(
this
.
low
Bu
b
);
this
.
showEl
(
this
.
high
Bu
b
);
this
.
hideEl
(
this
.
cmb
Bu
b
);
bubToAdjust
=
this
.
high
Bu
b
;
this
.
showEl
(
this
.
low
La
b
);
this
.
showEl
(
this
.
high
La
b
);
this
.
hideEl
(
this
.
cmb
La
b
);
bubToAdjust
=
this
.
high
La
b
;
}
}
if
(
this
.
gap
(
this
.
flr
Bub
,
this
.
lowBu
b
)
<
5
)
if
(
this
.
gap
(
this
.
flr
Lab
,
this
.
lowLa
b
)
<
5
)
{
this
.
hideEl
(
this
.
flr
Bu
b
);
this
.
hideEl
(
this
.
flr
La
b
);
}
else
{
if
(
this
.
range
)
{
if
(
this
.
gap
(
this
.
flr
Bu
b
,
bubToAdjust
)
<
5
)
if
(
this
.
gap
(
this
.
flr
La
b
,
bubToAdjust
)
<
5
)
{
this
.
hideEl
(
this
.
flr
Bu
b
);
this
.
hideEl
(
this
.
flr
La
b
);
}
else
{
this
.
showEl
(
this
.
flr
Bu
b
);
this
.
showEl
(
this
.
flr
La
b
);
}
}
else
{
this
.
showEl
(
this
.
flr
Bu
b
);
this
.
showEl
(
this
.
flr
La
b
);
}
}
if
(
this
.
gap
(
this
.
low
Bub
,
this
.
ceilBu
b
)
<
5
)
if
(
this
.
gap
(
this
.
low
Lab
,
this
.
ceilLa
b
)
<
5
)
{
this
.
hideEl
(
this
.
ceil
Bu
b
);
this
.
hideEl
(
this
.
ceil
La
b
);
}
else
{
if
(
this
.
range
)
{
if
(
this
.
gap
(
bubToAdjust
,
this
.
ceil
Bu
b
)
<
5
)
if
(
this
.
gap
(
bubToAdjust
,
this
.
ceil
La
b
)
<
5
)
{
this
.
hideEl
(
this
.
ceil
Bu
b
);
this
.
hideEl
(
this
.
ceil
La
b
);
}
else
{
this
.
showEl
(
this
.
ceil
Bu
b
);
this
.
showEl
(
this
.
ceil
La
b
);
}
}
else
{
this
.
showEl
(
this
.
ceil
Bu
b
);
this
.
showEl
(
this
.
ceil
La
b
);
}
}
// TODO:
if
(
arguments
[
0
]
===
'timeout'
)
{
Slider
.
prototype
.
adjustLabels
=
throttle
(
Slider
.
prototype
.
adjustLabels
,
350
);
}
},
/**
...
...
@@ -824,8 +793,6 @@ function throttle(func, wait, options) {
}
};
Slider
.
prototype
.
adjustLabels
=
throttle
(
Slider
.
prototype
.
adjustLabels
,
350
);
return
Slider
;
}])
...
...
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