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
3afcce95
Commit
3afcce95
authored
Feb 06, 2016
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(cmbLabel): Improve combined label position and show only one value if min==max
Closes #245
parent
4bff1a84
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
22 deletions
+46
-22
rzslider.js
dist/rzslider.js
+22
-10
rzslider.min.js
dist/rzslider.min.js
+1
-1
rzslider.js
src/rzslider.js
+22
-10
rz-slider-service-test.js
tests/spec/rz-slider-service-test.js
+1
-1
No files found.
dist/rzslider.js
View file @
3afcce95
...
...
@@ -880,7 +880,13 @@
updateLowHandle
:
function
(
newOffset
)
{
this
.
setPosition
(
this
.
minH
,
newOffset
);
this
.
translateFn
(
this
.
scope
.
rzSliderModel
,
this
.
minLab
);
var
pos
=
Math
.
min
(
Math
.
max
(
newOffset
-
this
.
minLab
.
rzsd
/
2
+
this
.
handleHalfDim
,
0
),
this
.
barDimension
-
this
.
ceilLab
.
rzsd
);
var
pos
=
Math
.
min
(
Math
.
max
(
newOffset
-
this
.
minLab
.
rzsd
/
2
+
this
.
handleHalfDim
,
0
),
this
.
barDimension
-
this
.
ceilLab
.
rzsd
);
this
.
setPosition
(
this
.
minLab
,
pos
);
this
.
shFloorCeil
();
...
...
@@ -895,7 +901,7 @@
updateHighHandle
:
function
(
newOffset
)
{
this
.
setPosition
(
this
.
maxH
,
newOffset
);
this
.
translateFn
(
this
.
scope
.
rzSliderHigh
,
this
.
maxLab
);
var
pos
=
Math
.
min
(
(
newOffset
-
this
.
maxLab
.
rzsd
/
2
+
this
.
handleHalfDim
),
(
this
.
barDimension
-
this
.
ceilLab
.
rzsd
)
);
var
pos
=
Math
.
min
(
newOffset
-
this
.
maxLab
.
rzsd
/
2
+
this
.
handleHalfDim
,
this
.
barDimension
-
this
.
ceilLab
.
rzsd
);
this
.
setPosition
(
this
.
maxLab
,
pos
);
this
.
shFloorCeil
();
...
...
@@ -950,8 +956,8 @@
updateSelectionBar
:
function
()
{
var
position
=
0
,
dimension
=
0
;
if
(
this
.
range
)
{
dimension
=
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
)
+
this
.
handleHalfDim
;
if
(
this
.
range
)
{
dimension
=
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
);
position
=
this
.
minH
.
rzsp
+
this
.
handleHalfDim
;
}
else
{
...
...
@@ -1001,14 +1007,20 @@
* @returns {undefined}
*/
updateCmbLabel
:
function
()
{
var
lowTr
,
highTr
;
if
(
this
.
minLab
.
rzsp
+
this
.
minLab
.
rzsd
+
10
>=
this
.
maxLab
.
rzsp
)
{
lowTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderModel
);
highTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderHigh
);
this
.
translateFn
(
lowTr
+
' - '
+
highTr
,
this
.
cmbLab
,
false
);
var
pos
=
Math
.
min
(
Math
.
max
((
this
.
selBar
.
rzsp
+
this
.
selBar
.
rzsd
/
2
-
this
.
cmbLab
.
rzsd
/
2
),
0
),
(
this
.
barDimension
-
this
.
cmbLab
.
rzsd
));
var
lowTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderModel
),
highTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderHigh
),
labelVal
=
lowTr
===
highTr
?
lowTr
:
lowTr
+
' - '
+
highTr
;
this
.
translateFn
(
labelVal
,
this
.
cmbLab
,
false
);
var
pos
=
Math
.
min
(
Math
.
max
(
this
.
selBar
.
rzsp
+
this
.
selBar
.
rzsd
/
2
-
this
.
cmbLab
.
rzsd
/
2
,
0
),
this
.
barDimension
-
this
.
cmbLab
.
rzsd
);
this
.
setPosition
(
this
.
cmbLab
,
pos
);
this
.
hideEl
(
this
.
minLab
);
this
.
hideEl
(
this
.
maxLab
);
...
...
dist/rzslider.min.js
View file @
3afcce95
This diff is collapsed.
Click to expand it.
src/rzslider.js
View file @
3afcce95
...
...
@@ -884,7 +884,13 @@
updateLowHandle
:
function
(
newOffset
)
{
this
.
setPosition
(
this
.
minH
,
newOffset
);
this
.
translateFn
(
this
.
scope
.
rzSliderModel
,
this
.
minLab
);
var
pos
=
Math
.
min
(
Math
.
max
(
newOffset
-
this
.
minLab
.
rzsd
/
2
+
this
.
handleHalfDim
,
0
),
this
.
barDimension
-
this
.
ceilLab
.
rzsd
);
var
pos
=
Math
.
min
(
Math
.
max
(
newOffset
-
this
.
minLab
.
rzsd
/
2
+
this
.
handleHalfDim
,
0
),
this
.
barDimension
-
this
.
ceilLab
.
rzsd
);
this
.
setPosition
(
this
.
minLab
,
pos
);
this
.
shFloorCeil
();
...
...
@@ -899,7 +905,7 @@
updateHighHandle
:
function
(
newOffset
)
{
this
.
setPosition
(
this
.
maxH
,
newOffset
);
this
.
translateFn
(
this
.
scope
.
rzSliderHigh
,
this
.
maxLab
);
var
pos
=
Math
.
min
(
(
newOffset
-
this
.
maxLab
.
rzsd
/
2
+
this
.
handleHalfDim
),
(
this
.
barDimension
-
this
.
ceilLab
.
rzsd
)
);
var
pos
=
Math
.
min
(
newOffset
-
this
.
maxLab
.
rzsd
/
2
+
this
.
handleHalfDim
,
this
.
barDimension
-
this
.
ceilLab
.
rzsd
);
this
.
setPosition
(
this
.
maxLab
,
pos
);
this
.
shFloorCeil
();
...
...
@@ -954,8 +960,8 @@
updateSelectionBar
:
function
()
{
var
position
=
0
,
dimension
=
0
;
if
(
this
.
range
)
{
dimension
=
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
)
+
this
.
handleHalfDim
;
if
(
this
.
range
)
{
dimension
=
Math
.
abs
(
this
.
maxH
.
rzsp
-
this
.
minH
.
rzsp
);
position
=
this
.
minH
.
rzsp
+
this
.
handleHalfDim
;
}
else
{
...
...
@@ -1005,14 +1011,20 @@
* @returns {undefined}
*/
updateCmbLabel
:
function
()
{
var
lowTr
,
highTr
;
if
(
this
.
minLab
.
rzsp
+
this
.
minLab
.
rzsd
+
10
>=
this
.
maxLab
.
rzsp
)
{
lowTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderModel
);
highTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderHigh
);
this
.
translateFn
(
lowTr
+
' - '
+
highTr
,
this
.
cmbLab
,
false
);
var
pos
=
Math
.
min
(
Math
.
max
((
this
.
selBar
.
rzsp
+
this
.
selBar
.
rzsd
/
2
-
this
.
cmbLab
.
rzsd
/
2
),
0
),
(
this
.
barDimension
-
this
.
cmbLab
.
rzsd
));
var
lowTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderModel
),
highTr
=
this
.
getDisplayValue
(
this
.
scope
.
rzSliderHigh
),
labelVal
=
lowTr
===
highTr
?
lowTr
:
lowTr
+
' - '
+
highTr
;
this
.
translateFn
(
labelVal
,
this
.
cmbLab
,
false
);
var
pos
=
Math
.
min
(
Math
.
max
(
this
.
selBar
.
rzsp
+
this
.
selBar
.
rzsd
/
2
-
this
.
cmbLab
.
rzsd
/
2
,
0
),
this
.
barDimension
-
this
.
cmbLab
.
rzsd
);
this
.
setPosition
(
this
.
cmbLab
,
pos
);
this
.
hideEl
(
this
.
minLab
);
this
.
hideEl
(
this
.
maxLab
);
...
...
tests/spec/rz-slider-service-test.js
View file @
3afcce95
...
...
@@ -514,7 +514,7 @@ describe('rzslider - ', function() {
}
};
createRangeSlider
(
sliderConf
);
var
expectedDimension
=
slider
.
valueToOffset
(
6
)
+
slider
.
handleHalfDim
,
var
expectedDimension
=
slider
.
valueToOffset
(
6
),
expectedPosition
=
slider
.
valueToOffset
(
2
)
+
slider
.
handleHalfDim
;
expect
(
slider
.
selBar
.
css
(
'width'
)).
to
.
equal
(
expectedDimension
+
'px'
);
expect
(
slider
.
selBar
.
css
(
'left'
)).
to
.
equal
(
expectedPosition
+
'px'
);
...
...
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