MCPcopy
hub / github.com/angular-ui/ui-grid / groupAnimations

Function groupAnimations

lib/test/angular/1.5.0/angular-animate.js:3063–3144  ·  view source on GitHub ↗
(animations)

Source from the content-addressed store, hash-verified

3061 }
3062
3063 function groupAnimations(animations) {
3064 var preparedAnimations = [];
3065 var refLookup = {};
3066 forEach(animations, function(animation, index) {
3067 var element = animation.element;
3068 var node = getDomNode(element);
3069 var event = animation.event;
3070 var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;
3071 var anchorNodes = animation.structural ? getAnchorNodes(node) : [];
3072
3073 if (anchorNodes.length) {
3074 var direction = enterOrMove ? 'to' : 'from';
3075
3076 forEach(anchorNodes, function(anchor) {
3077 var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);
3078 refLookup[key] = refLookup[key] || {};
3079 refLookup[key][direction] = {
3080 animationID: index,
3081 element: jqLite(anchor)
3082 };
3083 });
3084 } else {
3085 preparedAnimations.push(animation);
3086 }
3087 });
3088
3089 var usedIndicesLookup = {};
3090 var anchorGroups = {};
3091 forEach(refLookup, function(operations, key) {
3092 var from = operations.from;
3093 var to = operations.to;
3094
3095 if (!from || !to) {
3096 // only one of these is set therefore we can't have an
3097 // anchor animation since all three pieces are required
3098 var index = from ? from.animationID : to.animationID;
3099 var indexKey = index.toString();
3100 if (!usedIndicesLookup[indexKey]) {
3101 usedIndicesLookup[indexKey] = true;
3102 preparedAnimations.push(animations[index]);
3103 }
3104 return;
3105 }
3106
3107 var fromAnimation = animations[from.animationID];
3108 var toAnimation = animations[to.animationID];
3109 var lookupKey = from.animationID.toString();
3110 if (!anchorGroups[lookupKey]) {
3111 var group = anchorGroups[lookupKey] = {
3112 structural: true,
3113 beforeStart: function() {
3114 fromAnimation.beforeStart();
3115 toAnimation.beforeStart();
3116 },
3117 close: function() {
3118 fromAnimation.close();
3119 toAnimation.close();
3120 },

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