// Copyright (c) The Perspex Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Collections.Generic;
using System.Linq;
namespace Perspex.Interactivity
{
///
/// Provides extension methods for the interface.
///
public static class InteractiveExtensions
{
///
/// Gets the route for bubbling events from the specified interactive.
///
/// The interactive.
/// The event route.
public static IEnumerable GetBubbleEventRoute(this IInteractive interactive)
{
while (interactive != null)
{
yield return interactive;
interactive = interactive.InteractiveParent;
}
}
///
/// Gets the route for tunneling events from the specified interactive.
///
/// The interactive.
/// The event route.
public static IEnumerable GetTunnelEventRoute(this IInteractive interactive)
{
return interactive.GetBubbleEventRoute().Reverse();
}
}
}