perf(collectionRepeat): only close option buttons if theyre open

It's a hack, but it's the best we can do right now.
This commit is contained in:
Andrew
2015-03-11 11:52:05 -06:00
parent 83a20c61e6
commit ee222c0246
3 changed files with 11 additions and 16 deletions

View File

@@ -666,27 +666,19 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) {
function digestEnteringItems() {
var item;
var scope;
var len;
if (digestEnteringItems.running) return;
digestEnteringItems.running = true;
$$rAF(function process() {
if( (len = itemsEntering.length) ) {
var rootScopePhase = $rootScope.$$phase;
var count = Math.floor(len / 1.25) || 1;
while (count && itemsEntering.length) {
item = itemsEntering.pop();
if (item.isShown) {
count--;
if (!rootScopePhase) item.scope.$digest();
item.scope.$broadcast('$collectionRepeatLeave');
}
var rootScopePhase = $rootScope.$$phase;
while (itemsEntering.length) {
item = itemsEntering.pop();
if (item.isShown) {
if (!rootScopePhase) item.scope.$digest();
item.scope.$broadcast('$collectionRepeatLeave');
}
$$rAF(process);
} else {
digestEnteringItems.running = false;
}
digestEnteringItems.running = false;
});
}

View File

@@ -67,12 +67,13 @@ IonicModule
var content = $element[0].querySelector('.item-content');
if (content) {
$scope.$on('$collectionRepeatLeave', function() {
if (content) {
if (content && content.$$ionicOptionsOpen) {
content.style[ionic.CSS.TRANSFORM] = '';
content.style[ionic.CSS.TRANSITION] = 'none';
$$rAF(function() {
content.style[ionic.CSS.TRANSITION] = '';
});
content.$$ionicOptionsOpen = false;
}
});
}

View File

@@ -135,6 +135,8 @@
newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));
}
this._currentDrag.content.$$ionicOptionsOpen = newX !== 0;
this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + newX + 'px, 0, 0)';
this._currentDrag.content.style[ionic.CSS.TRANSITION] = 'none';
}