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
72c7e74c
Commit
72c7e74c
authored
Oct 25, 2015
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve behavior when scope value is out of slider range
Implement the solution described in #159 .
parent
271b4967
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
23 deletions
+29
-23
rzslider.js
dist/rzslider.js
+14
-11
rzslider.min.js
dist/rzslider.min.js
+1
-1
rzslider.js
src/rzslider.js
+14
-11
No files found.
dist/rzslider.js
View file @
72c7e74c
...
@@ -568,23 +568,15 @@
...
@@ -568,23 +568,15 @@
this
.
step
=
+
this
.
options
.
step
;
this
.
step
=
+
this
.
options
.
step
;
this
.
precision
=
+
this
.
options
.
precision
;
this
.
precision
=
+
this
.
options
.
precision
;
this
.
scope
.
rzSliderModel
=
this
.
roundStep
(
this
.
scope
.
rzSliderModel
);
this
.
scope
.
rzSliderModel
=
this
.
roundStep
(
this
.
scope
.
rzSliderModel
);
if
(
this
.
range
)
if
(
this
.
range
)
this
.
scope
.
rzSliderHigh
=
this
.
roundStep
(
this
.
scope
.
rzSliderHigh
);
this
.
scope
.
rzSliderHigh
=
this
.
roundStep
(
this
.
scope
.
rzSliderHigh
);
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
);
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
);
if
(
this
.
scope
.
rzSliderModel
<
this
.
minValue
)
this
.
scope
.
rzSliderModel
=
this
.
minValue
;
if
(
this
.
range
&&
this
.
scope
.
rzSliderHigh
<
this
.
minValue
)
this
.
scope
.
rzSliderHigh
=
this
.
minValue
;
if
(
this
.
options
.
ceil
)
{
if
(
this
.
options
.
ceil
)
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
);
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
);
if
(
this
.
scope
.
rzSliderModel
>
this
.
maxValue
)
this
.
scope
.
rzSliderModel
=
this
.
maxValue
;
if
(
this
.
range
&&
this
.
scope
.
rzSliderHigh
>
this
.
maxValue
)
this
.
scope
.
rzSliderHigh
=
this
.
maxValue
;
}
else
else
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
;
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
;
...
@@ -957,7 +949,18 @@
...
@@ -957,7 +949,18 @@
* @returns {number}
* @returns {number}
*/
*/
valueToOffset
:
function
(
val
)
{
valueToOffset
:
function
(
val
)
{
return
(
val
-
this
.
minValue
)
*
this
.
maxLeft
/
this
.
valueRange
||
0
;
return
(
this
.
sanitizeOffsetValue
(
val
)
-
this
.
minValue
)
*
this
.
maxLeft
/
this
.
valueRange
||
0
;
},
/**
* Ensure that the position rendered is within the slider bounds, even if the value is not
*
* @param {number} val
* @returns {number}
*/
sanitizeOffsetValue
:
function
(
val
)
{
return
Math
.
min
(
Math
.
max
(
val
,
this
.
minValue
),
this
.
maxValue
);
},
},
/**
/**
...
...
dist/rzslider.min.js
View file @
72c7e74c
This diff is collapsed.
Click to expand it.
src/rzslider.js
View file @
72c7e74c
...
@@ -568,23 +568,15 @@
...
@@ -568,23 +568,15 @@
this
.
step
=
+
this
.
options
.
step
;
this
.
step
=
+
this
.
options
.
step
;
this
.
precision
=
+
this
.
options
.
precision
;
this
.
precision
=
+
this
.
options
.
precision
;
this
.
scope
.
rzSliderModel
=
this
.
roundStep
(
this
.
scope
.
rzSliderModel
);
this
.
scope
.
rzSliderModel
=
this
.
roundStep
(
this
.
scope
.
rzSliderModel
);
if
(
this
.
range
)
if
(
this
.
range
)
this
.
scope
.
rzSliderHigh
=
this
.
roundStep
(
this
.
scope
.
rzSliderHigh
);
this
.
scope
.
rzSliderHigh
=
this
.
roundStep
(
this
.
scope
.
rzSliderHigh
);
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
);
this
.
minValue
=
this
.
roundStep
(
+
this
.
options
.
floor
);
if
(
this
.
scope
.
rzSliderModel
<
this
.
minValue
)
this
.
scope
.
rzSliderModel
=
this
.
minValue
;
if
(
this
.
range
&&
this
.
scope
.
rzSliderHigh
<
this
.
minValue
)
this
.
scope
.
rzSliderHigh
=
this
.
minValue
;
if
(
this
.
options
.
ceil
)
{
if
(
this
.
options
.
ceil
)
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
);
this
.
maxValue
=
this
.
roundStep
(
+
this
.
options
.
ceil
);
if
(
this
.
scope
.
rzSliderModel
>
this
.
maxValue
)
this
.
scope
.
rzSliderModel
=
this
.
maxValue
;
if
(
this
.
range
&&
this
.
scope
.
rzSliderHigh
>
this
.
maxValue
)
this
.
scope
.
rzSliderHigh
=
this
.
maxValue
;
}
else
else
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
;
this
.
maxValue
=
this
.
options
.
ceil
=
this
.
range
?
this
.
scope
.
rzSliderHigh
:
this
.
scope
.
rzSliderModel
;
...
@@ -957,7 +949,18 @@
...
@@ -957,7 +949,18 @@
* @returns {number}
* @returns {number}
*/
*/
valueToOffset
:
function
(
val
)
{
valueToOffset
:
function
(
val
)
{
return
(
val
-
this
.
minValue
)
*
this
.
maxLeft
/
this
.
valueRange
||
0
;
return
(
this
.
sanitizeOffsetValue
(
val
)
-
this
.
minValue
)
*
this
.
maxLeft
/
this
.
valueRange
||
0
;
},
/**
* Ensure that the position rendered is within the slider bounds, even if the value is not
*
* @param {number} val
* @returns {number}
*/
sanitizeOffsetValue
:
function
(
val
)
{
return
Math
.
min
(
Math
.
max
(
val
,
this
.
minValue
),
this
.
maxValue
);
},
},
/**
/**
...
...
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