/// <summary>
            /// Test whether the given location is a valid hit.
            /// </summary>
            /// <remarks>
            /// The hit is considered as valid if the location lies inside a node's top insets.
            /// </remarks>
            /// <param name="context">The current input mode context.</param>
            /// <param name="location">The location to test.</param>
            /// <returns></returns>
            public bool IsHit(IInputModeContext context, PointD location)
            {
                // Get the current hit tester from the input mode context
                IHitTester <IModelItem> enumerator = inputMode.InputModeContext.Lookup(typeof(IHitTester <IModelItem>)) as IHitTester <IModelItem>;

                if (enumerator != null)
                {
                    // get an enumerator over all elements at the given location
                    var hits = enumerator.EnumerateHits(inputMode.InputModeContext, location);
                    foreach (var item in hits)
                    {
                        // if the element is a node and its lookup returns an INodeInsetsProvider
                        var node = item as INode;
                        if (node != null)
                        {
                            var insetsProvider = node.Lookup <INodeInsetsProvider>();
                            if (insetsProvider != null)
                            {
                                // determine whether the given location lies inside the top insets
                                InsetsD insets = insetsProvider.GetInsets(node);
                                if (new RectD(node.Layout.X, node.Layout.Y, node.Layout.Width, insets.Top).Contains(location))
                                {
                                    // if so: return true
                                    return(true);
                                }
                                // else: continue iteration
                            }
                        }
                    }
                }
                // no hits found: return false
                return(false);
            }
 /// <summary>
 /// Determines the group node on that the mouse is currently hovering. If there is no
 /// group node <code>null</code> is returned.
 /// </summary>
 private INode GetHitGroupNode(IInputModeContext context)
 {
     return(nodeHitTester.EnumerateHits(context, context.CanvasControl.LastEventLocation)
            .FirstOrDefault(n => Graph.IsGroupNode(n)));
 }