Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ export class AnimationTransitionNamespace {
return trigger;
}

trigger(element: any, triggerName: string, value: any, defaultToFallback: boolean = true):
TransitionAnimationPlayer|undefined {
trigger(
element: any, triggerName: string, value: any, defaultToFallback: boolean = true,
isSubElementRemoval: boolean = false): TransitionAnimationPlayer|undefined {
const trigger = this._getTrigger(triggerName);
const player = new TransitionAnimationPlayer(this.id, triggerName, element);

Expand All @@ -203,21 +204,11 @@ export class AnimationTransitionNamespace {
toState.absorbOptions(fromState.options);
}

triggersWithStates[triggerName] = toState;

if (!fromState) {
fromState = DEFAULT_STATE_VALUE;
}

const isRemoval = toState.value === VOID_VALUE;

// normally this isn't reached by here, however, if an object expression
// is passed in then it may be a new object each time. Comparing the value
// is important since that will stay the same despite there being a new object.
// The removal arc here is special cased because the same element is triggered
// twice in the event that it contains animations on the outer/inner portions
// of the host container
if (!isRemoval && fromState.value === toState.value) {
if (!isSubElementRemoval && fromState.value === toState.value) {
// this means that despite the value not changing, some inner params
// have changed which means that the animation final styles need to be applied
if (!objEquals(fromState.params, toState.params)) {
Expand All @@ -236,6 +227,8 @@ export class AnimationTransitionNamespace {
return;
}

triggersWithStates[triggerName] = toState;

const playersOnElement: TransitionAnimationPlayer[] =
getOrSetAsInMap(this._engine.playersByElement, element, []);
playersOnElement.forEach(player => {
Expand Down Expand Up @@ -336,7 +329,7 @@ export class AnimationTransitionNamespace {
// this check is here in the event that an element is removed
// twice (both on the host level and the component level)
if (this._triggers[triggerName]) {
const player = this.trigger(element, triggerName, VOID_VALUE, defaultToFallback);
const player = this.trigger(element, triggerName, VOID_VALUE, defaultToFallback, true);
if (player) {
players.push(player);
}
Expand Down