Skip to content

Commit

Permalink
perf(refresher): don't use parseInt
Browse files Browse the repository at this point in the history
  • Loading branch information
mlynch committed Dec 17, 2015
1 parent f7fa985 commit 97bb63e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/angular/controller/refresherController.js
Expand Up @@ -45,7 +45,7 @@ IonicModule
screenY: e.screenY
}];
// Mouse needs this
startY = parseInt(e.touches[0].screenY, 10);
startY = Math.floor(e.touches[0].screenY);
}

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

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

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

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

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

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

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

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

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

if (time < 1) {
ionic.requestAnimationFrame(scroll);
Expand Down

0 comments on commit 97bb63e

Please sign in to comment.