mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
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:
22
js/angular/directive/collectionRepeat.js
vendored
22
js/angular/directive/collectionRepeat.js
vendored
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
3
js/angular/directive/item.js
vendored
3
js/angular/directive/item.js
vendored
@@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user