MCPcopy Index your code
hub / github.com/angular-ui/ui-router / groupAnimations

Function groupAnimations

test/angular/1.7/angular-animate.js:3194–3275  ·  view source on GitHub ↗
(animations)

Source from the content-addressed store, hash-verified

3192 }
3193
3194 function groupAnimations(animations) {
3195 var preparedAnimations = [];
3196 var refLookup = {};
3197 forEach(animations, function(animation, index) {
3198 var element = animation.element;
3199 var node = getDomNode(element);
3200 var event = animation.event;
3201 var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;
3202 var anchorNodes = animation.structural ? getAnchorNodes(node) : [];
3203
3204 if (anchorNodes.length) {
3205 var direction = enterOrMove ? 'to' : 'from';
3206
3207 forEach(anchorNodes, function(anchor) {
3208 var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);
3209 refLookup[key] = refLookup[key] || {};
3210 refLookup[key][direction] = {
3211 animationID: index,
3212 element: jqLite(anchor)
3213 };
3214 });
3215 } else {
3216 preparedAnimations.push(animation);
3217 }
3218 });
3219
3220 var usedIndicesLookup = {};
3221 var anchorGroups = {};
3222 forEach(refLookup, function(operations, key) {
3223 var from = operations.from;
3224 var to = operations.to;
3225
3226 if (!from || !to) {
3227 // only one of these is set therefore we can't have an
3228 // anchor animation since all three pieces are required
3229 var index = from ? from.animationID : to.animationID;
3230 var indexKey = index.toString();
3231 if (!usedIndicesLookup[indexKey]) {
3232 usedIndicesLookup[indexKey] = true;
3233 preparedAnimations.push(animations[index]);
3234 }
3235 return;
3236 }
3237
3238 var fromAnimation = animations[from.animationID];
3239 var toAnimation = animations[to.animationID];
3240 var lookupKey = from.animationID.toString();
3241 if (!anchorGroups[lookupKey]) {
3242 var group = anchorGroups[lookupKey] = {
3243 structural: true,
3244 beforeStart: function() {
3245 fromAnimation.beforeStart();
3246 toAnimation.beforeStart();
3247 },
3248 close: function() {
3249 fromAnimation.close();
3250 toAnimation.close();
3251 },

Callers 1

angular-animate.jsFile · 0.70

Calls 4

forEachFunction · 0.70
getDomNodeFunction · 0.70
getAnchorNodesFunction · 0.70
cssClassesIntersectionFunction · 0.70

Tested by

no test coverage detected