Skip to content

Commit 97bb63e

Browse files
committed
perf(refresher): don't use parseInt
1 parent f7fa985 commit 97bb63e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Diff for: js/angular/controller/refresherController.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ IonicModule
4545
screenY: e.screenY
4646
}];
4747
// Mouse needs this
48-
startY = parseInt(e.touches[0].screenY, 10);
48+
startY = Math.floor(e.touches[0].screenY);
4949
}
5050

5151
function handleTouchend() {
@@ -89,7 +89,7 @@ IonicModule
8989
}
9090
//if this is a new drag, keep track of where we start
9191
if (startY === null) {
92-
startY = parseInt(e.touches[0].screenY, 10);
92+
startY = Math.floor(e.touches[0].screenY);
9393
}
9494

9595
// kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch
@@ -99,7 +99,7 @@ IonicModule
9999
}
100100

101101
// how far have we dragged so far?
102-
deltaY = parseInt(e.touches[0].screenY, 10) - startY;
102+
deltaY = Math.floor(e.touches[0].screenY) - startY;
103103

104104
// if we've dragged up and back down in to native scroll territory
105105
if (deltaY - dragOffset <= 0 || scrollParent.scrollTop !== 0) {
@@ -110,7 +110,7 @@ IonicModule
110110
}
111111

112112
if (isDragging) {
113-
nativescroll(scrollParent, parseInt(deltaY - dragOffset, 10) * -1);
113+
nativescroll(scrollParent, Math.floor(deltaY - dragOffset) * -1);
114114
}
115115

116116
// if we're not at overscroll 0 yet, 0 out
@@ -135,7 +135,7 @@ IonicModule
135135

136136
isDragging = true;
137137
// overscroll according to the user's drag so far
138-
overscroll(parseInt((deltaY - dragOffset) / 3, 10));
138+
overscroll(Math.floor((deltaY - dragOffset) / 3));
139139

140140
// update the icon accordingly
141141
if (!activated && lastOverscroll > ptrThreshold) {
@@ -231,7 +231,7 @@ IonicModule
231231
// fraction based on the easing method
232232
easedT = easeOutCubic(time);
233233

234-
overscroll(parseInt((easedT * (Y - from)) + from, 10));
234+
overscroll(Math.floor((easedT * (Y - from)) + from));
235235

236236
if (time < 1) {
237237
ionic.requestAnimationFrame(scroll);

0 commit comments

Comments
 (0)