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
dbab13de
Commit
dbab13de
authored
Dec 29, 2015
by
Valentin Hervieu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test(mouse events): Finish events tests for draggableRange
parent
256cdc76
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
455 additions
and
117 deletions
+455
-117
rzslider.js
dist/rzslider.js
+43
-70
rzslider.min.js
dist/rzslider.min.js
+2
-2
rzslider.js
src/rzslider.js
+34
-37
rz-slider-service-test.js
tests/spec/rz-slider-service-test.js
+376
-8
No files found.
dist/rzslider.js
View file @
dbab13de
/*! angularjs-slider - v2.3.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/angular-slider/angularjs-slider -
2015-12-2
4
*/
2015-12-2
9
*/
/*jslint unparam: true */
/*global angular: false, console: false, define, module */
(
function
(
root
,
factory
)
{
...
...
@@ -166,8 +166,8 @@
value
:
0
,
difference
:
0
,
offset
:
0
,
low
Dis
t
:
0
,
high
Dis
t
:
0
low
Limi
t
:
0
,
high
Limi
t
:
0
};
/**
...
...
@@ -287,10 +287,10 @@
this
.
applyOptions
();
this
.
initElemHandles
();
this
.
manageElementsStyle
();
this
.
addAccessibility
();
this
.
setDisabledState
();
this
.
calcViewDimensions
();
this
.
setMinAndMax
();
this
.
addAccessibility
();
$timeout
(
function
()
{
self
.
updateCeilLab
();
...
...
@@ -461,7 +461,6 @@
break
;
case
1
:
this
.
selBar
=
jElem
;
this
.
selBarChild
=
this
.
selBar
.
children
(
'rz-selection'
);
break
;
case
2
:
this
.
minH
=
jElem
;
...
...
@@ -839,34 +838,15 @@
* @param {number} newOffset
*/
updateHandles
:
function
(
which
,
newOffset
)
{
if
(
which
===
'rzSliderModel'
)
{
if
(
which
===
'rzSliderModel'
)
this
.
updateLowHandle
(
newOffset
);
this
.
updateSelectionBar
();
this
.
updateTicksScale
();
if
(
this
.
range
)
{
this
.
updateCmbLabel
();
}
return
;
}
if
(
which
===
'rzSliderHigh'
)
{
else
if
(
which
===
'rzSliderHigh'
)
this
.
updateHighHandle
(
newOffset
);
this
.
updateSelectionBar
();
this
.
updateTicksScale
();
if
(
this
.
range
)
{
this
.
updateCmbLabel
();
}
return
;
}
// Update both
this
.
updateLowHandle
(
newOffset
);
this
.
updateHighHandle
(
newOffset
);
this
.
updateSelectionBar
();
this
.
updateTicksScale
();
this
.
updateCmbLabel
();
if
(
this
.
range
)
this
.
updateCmbLabel
();
},
/**
...
...
@@ -1007,7 +987,8 @@
* @returns {number}
*/
roundStep
:
function
(
value
)
{
var
steppedValue
=
Math
.
round
(
value
/
this
.
step
)
*
this
.
step
;
var
steppedValue
=
parseFloat
(
value
/
this
.
step
).
toPrecision
(
12
)
steppedValue
=
Math
.
round
(
steppedValue
)
*
this
.
step
;
steppedValue
=
steppedValue
.
toFixed
(
this
.
precision
);
return
+
steppedValue
;
},
...
...
@@ -1150,6 +1131,30 @@
return
(
eventPos
-
this
.
handleHalfDim
)
*
this
.
options
.
scale
;
},
/**
* Get event names for move and event end
*
* @param {Event} event The event
*
* @return {{moveEvent: string, endEvent: string}}
*/
getEventNames
:
function
(
event
)
{
var
eventNames
=
{
moveEvent
:
''
,
endEvent
:
''
};
if
(
event
.
touches
||
(
event
.
originalEvent
!==
undefined
&&
event
.
originalEvent
.
touches
))
{
eventNames
.
moveEvent
=
'touchmove'
;
eventNames
.
endEvent
=
'touchend'
;
}
else
{
eventNames
.
moveEvent
=
'mousemove'
;
eventNames
.
endEvent
=
'mouseup'
;
}
return
eventNames
;
},
/**
* Get the handle closest to an event.
*
...
...
@@ -1180,7 +1185,6 @@
* @returns {undefined}
*/
bindEvents
:
function
()
{
if
(
this
.
options
.
readOnly
||
this
.
options
.
disabled
)
return
;
var
barTracking
,
barStart
,
barMove
;
if
(
this
.
options
.
draggableRange
)
{
...
...
@@ -1198,9 +1202,7 @@
if
(
this
.
options
.
draggableRangeOnly
)
{
this
.
minH
.
on
(
'mousedown'
,
angular
.
bind
(
this
,
barStart
,
null
,
barTracking
));
if
(
this
.
range
)
{
this
.
maxH
.
on
(
'mousedown'
,
angular
.
bind
(
this
,
barStart
,
null
,
barTracking
));
}
this
.
maxH
.
on
(
'mousedown'
,
angular
.
bind
(
this
,
barStart
,
null
,
barTracking
));
}
else
{
this
.
minH
.
on
(
'mousedown'
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
minH
,
'rzSliderModel'
));
if
(
this
.
range
)
{
...
...
@@ -1216,9 +1218,7 @@
this
.
selBar
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
barMove
,
this
.
selBar
));
if
(
this
.
options
.
draggableRangeOnly
)
{
this
.
minH
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
barStart
,
null
,
barTracking
));
if
(
this
.
range
)
{
this
.
maxH
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
barStart
,
null
,
barTracking
));
}
this
.
maxH
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
barStart
,
null
,
barTracking
));
}
else
{
this
.
minH
.
on
(
'touchstart'
,
angular
.
bind
(
this
,
this
.
onStart
,
this
.
minH
,
'rzSliderModel'
));
if
(
this
.
range
)
{
...
...
@@ -1431,9 +1431,8 @@
active
:
true
,
value
:
this
.
offsetToValue
(
offset
),
difference
:
this
.
scope
.
rzSliderHigh
-
this
.
scope
.
rzSliderModel
,
offset
:
offset
,
lowDist
:
offset
-
this
.
minH
.
rzsp
,
highDist
:
this
.
maxH
.
rzsp
-
offset
lowLimit
:
offset
-
this
.
minH
.
rzsp
,
highLimit
:
this
.
maxH
.
rzsp
-
offset
};
this
.
onStart
(
pointer
,
ref
,
event
);
...
...
@@ -1453,24 +1452,22 @@
newMinOffset
,
newMaxOffset
,
newMinValue
,
newMaxValue
;
if
(
newOffset
<=
this
.
dragging
.
low
Dis
t
)
{
if
(
pointer
.
rzsp
===
this
.
dragging
.
lowDist
)
{
if
(
newOffset
<=
this
.
dragging
.
low
Limi
t
)
{
if
(
this
.
minH
.
rzsp
===
0
)
return
;
}
newMinValue
=
this
.
minValue
;
newMinOffset
=
0
;
newMaxValue
=
this
.
minValue
+
this
.
dragging
.
difference
;
newMaxOffset
=
this
.
valueToOffset
(
newMaxValue
);
}
else
if
(
newOffset
>=
this
.
maxPos
-
this
.
dragging
.
high
Dis
t
)
{
if
(
pointer
.
rzsp
===
this
.
dragging
.
highDist
)
{
}
else
if
(
newOffset
>=
this
.
maxPos
-
this
.
dragging
.
high
Limi
t
)
{
if
(
this
.
maxH
.
rzsp
===
this
.
maxPos
)
return
;
}
newMaxValue
=
this
.
maxValue
;
newMaxOffset
=
this
.
maxPos
;
newMinValue
=
this
.
maxValue
-
this
.
dragging
.
difference
;
newMinOffset
=
this
.
valueToOffset
(
newMinValue
);
}
else
{
newMinValue
=
this
.
offsetToValue
(
newOffset
-
this
.
dragging
.
low
Dis
t
);
newMinValue
=
this
.
offsetToValue
(
newOffset
-
this
.
dragging
.
low
Limi
t
);
newMinValue
=
this
.
roundStep
(
newMinValue
);
newMinOffset
=
this
.
valueToOffset
(
newMinValue
);
newMaxValue
=
newMinValue
+
this
.
dragging
.
difference
;
...
...
@@ -1546,30 +1543,6 @@
return
switched
;
},
/**
* Get event names for move and event end
*
* @param {Event} event The event
*
* @return {{moveEvent: string, endEvent: string}}
*/
getEventNames
:
function
(
event
)
{
var
eventNames
=
{
moveEvent
:
''
,
endEvent
:
''
};
if
(
event
.
touches
||
(
event
.
originalEvent
!==
undefined
&&
event
.
originalEvent
.
touches
))
{
eventNames
.
moveEvent
=
'touchmove'
;
eventNames
.
endEvent
=
'touchend'
;
}
else
{
eventNames
.
moveEvent
=
'mousemove'
;
eventNames
.
endEvent
=
'mouseup'
;
}
return
eventNames
;
},
/**
* Apply the model values using scope.$apply.
* We wrap it with the internalChange flag to avoid the watchers to be called
...
...
dist/rzslider.min.js
View file @
dbab13de
This diff is collapsed.
Click to expand it.
src/rzslider.js
View file @
dbab13de
...
...
@@ -170,8 +170,8 @@
value
:
0
,
difference
:
0
,
offset
:
0
,
low
Dis
t
:
0
,
high
Dis
t
:
0
low
Limi
t
:
0
,
high
Limi
t
:
0
};
/**
...
...
@@ -1135,6 +1135,30 @@
return
(
eventPos
-
this
.
handleHalfDim
)
*
this
.
options
.
scale
;
},
/**
* Get event names for move and event end
*
* @param {Event} event The event
*
* @return {{moveEvent: string, endEvent: string}}
*/
getEventNames
:
function
(
event
)
{
var
eventNames
=
{
moveEvent
:
''
,
endEvent
:
''
};
if
(
event
.
touches
||
(
event
.
originalEvent
!==
undefined
&&
event
.
originalEvent
.
touches
))
{
eventNames
.
moveEvent
=
'touchmove'
;
eventNames
.
endEvent
=
'touchend'
;
}
else
{
eventNames
.
moveEvent
=
'mousemove'
;
eventNames
.
endEvent
=
'mouseup'
;
}
return
eventNames
;
},
/**
* Get the handle closest to an event.
*
...
...
@@ -1280,7 +1304,7 @@
onMove
:
function
(
pointer
,
event
)
{
var
newOffset
=
this
.
getEventPosition
(
event
),
newValue
;
if
(
newOffset
<=
0
)
{
if
(
pointer
.
rzsp
===
0
)
return
;
...
...
@@ -1411,9 +1435,8 @@
active
:
true
,
value
:
this
.
offsetToValue
(
offset
),
difference
:
this
.
scope
.
rzSliderHigh
-
this
.
scope
.
rzSliderModel
,
offset
:
offset
,
lowDist
:
offset
-
this
.
minH
.
rzsp
,
highDist
:
this
.
maxH
.
rzsp
-
offset
lowLimit
:
offset
-
this
.
minH
.
rzsp
,
highLimit
:
this
.
maxH
.
rzsp
-
offset
};
this
.
onStart
(
pointer
,
ref
,
event
);
...
...
@@ -1433,24 +1456,22 @@
newMinOffset
,
newMaxOffset
,
newMinValue
,
newMaxValue
;
if
(
newOffset
<=
this
.
dragging
.
low
Dis
t
)
{
if
(
pointer
.
rzsp
===
this
.
dragging
.
lowDist
)
{
if
(
newOffset
<=
this
.
dragging
.
low
Limi
t
)
{
if
(
this
.
minH
.
rzsp
===
0
)
return
;
}
newMinValue
=
this
.
minValue
;
newMinOffset
=
0
;
newMaxValue
=
this
.
minValue
+
this
.
dragging
.
difference
;
newMaxOffset
=
this
.
valueToOffset
(
newMaxValue
);
}
else
if
(
newOffset
>=
this
.
maxPos
-
this
.
dragging
.
high
Dis
t
)
{
if
(
pointer
.
rzsp
===
this
.
dragging
.
highDist
)
{
}
else
if
(
newOffset
>=
this
.
maxPos
-
this
.
dragging
.
high
Limi
t
)
{
if
(
this
.
maxH
.
rzsp
===
this
.
maxPos
)
return
;
}
newMaxValue
=
this
.
maxValue
;
newMaxOffset
=
this
.
maxPos
;
newMinValue
=
this
.
maxValue
-
this
.
dragging
.
difference
;
newMinOffset
=
this
.
valueToOffset
(
newMinValue
);
}
else
{
newMinValue
=
this
.
offsetToValue
(
newOffset
-
this
.
dragging
.
low
Dis
t
);
newMinValue
=
this
.
offsetToValue
(
newOffset
-
this
.
dragging
.
low
Limi
t
);
newMinValue
=
this
.
roundStep
(
newMinValue
);
newMinOffset
=
this
.
valueToOffset
(
newMinValue
);
newMaxValue
=
newMinValue
+
this
.
dragging
.
difference
;
...
...
@@ -1526,30 +1547,6 @@
return
switched
;
},
/**
* Get event names for move and event end
*
* @param {Event} event The event
*
* @return {{moveEvent: string, endEvent: string}}
*/
getEventNames
:
function
(
event
)
{
var
eventNames
=
{
moveEvent
:
''
,
endEvent
:
''
};
if
(
event
.
touches
||
(
event
.
originalEvent
!==
undefined
&&
event
.
originalEvent
.
touches
))
{
eventNames
.
moveEvent
=
'touchmove'
;
eventNames
.
endEvent
=
'touchend'
;
}
else
{
eventNames
.
moveEvent
=
'mousemove'
;
eventNames
.
endEvent
=
'mouseup'
;
}
return
eventNames
;
},
/**
* Apply the model values using scope.$apply.
* We wrap it with the internalChange flag to avoid the watchers to be called
...
...
tests/spec/rz-slider-service-test.js
View file @
dbab13de
This diff is collapsed.
Click to expand it.
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