// ----------------------------------------------------------------------- // // Copyright 2015 MIT Licence. See licence.md for more information. // // ----------------------------------------------------------------------- namespace Perspex.Interactivity { using System.Collections.Generic; using System.Linq; /// /// 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(); } } }