refactor(activator): activate immediately when not scrolling

This commit is contained in:
Adam Bradley
2014-12-03 01:54:28 -06:00
parent 8a6bf1ab6f
commit d1c92dae14

View File

@@ -14,7 +14,7 @@
// when an element is touched/clicked, it climbs up a few
// parents to see if it is an .item or .button element
ionic.requestAnimationFrame(function() {
if (ionic.tap.requiresNativeClick(e.target)) return;
if ((ionic.scroll && ionic.scroll.isScrolling) || ionic.tap.requiresNativeClick(e.target)) return;
var ele = e.target;
var eleToActivate;
@@ -33,7 +33,7 @@
break;
}
// no sense climbing past these
if (ele.classList.contains('pane') || ele.tagName == 'BODY' || ele.tagName == 'ION-CONTENT') {
if (ele.tagName == 'ION-CONTENT' || ele.classList.contains('pane') || ele.tagName == 'BODY') {
break;
}
ele = ele.parentElement;
@@ -43,14 +43,10 @@
// queue that this element should be set to active
queueElements[keyId] = eleToActivate;
// in XX milliseconds, set the queued elements to active
if (e.type === 'touchstart') {
self._activateTimeout = setTimeout(activateElements, 80);
} else {
ionic.requestAnimationFrame(activateElements);
}
// on the next frame, set the queued elements to active
ionic.requestAnimationFrame(activateElements);
keyId = (keyId > 19 ? 0 : keyId + 1);
keyId = (keyId > 29 ? 0 : keyId + 1);
}
});
@@ -58,7 +54,6 @@
end: function() {
// clear out any active/queued elements after XX milliseconds
clearTimeout(self._activateTimeout);
setTimeout(clear, 200);
}
@@ -85,7 +80,7 @@
function deactivateElements() {
if (ionic.transition && ionic.transition.isActive) {
setTimeout(deactivateElements, 500);
setTimeout(deactivateElements, 400);
return;
}