private void CanvasOnMouse2DPressed(object sender, Mouse2DEventArgs me)
        {
            // get hitTester from context
            var hitTest = InputModeContext.Lookup <IHitTester <INode> >();

            // take first node and request mutex
            node = hitTest.EnumerateHits(InputModeContext, me.Location).FirstOrDefault();
        }
Exemple #2
0
        private void OnMouseMoved(object sender, Mouse2DEventArgs e)
        {
            var location = e.Location;
            // Find items at the current location that have our special IClickHandler
            var hitTester = InputModeContext.Lookup <IHitTester <IModelItem> >();
            var hits      = hitTester.EnumerateHits(InputModeContext, location);

            foreach (var hit in hits)
            {
                var clickHandler = hit.Lookup <IClickHandler>() as IEnhancedClickHandler;
                if (clickHandler != null)
                {
                    // If we hit that IClickHandler, then store the current one (which updates the cursor as well)
                    if (clickHandler.HitTestable.IsHit(InputModeContext, location))
                    {
                        SetCurrentClickHandler(clickHandler);
                        return;
                    }
                }
            }
            // No IClickHandler hit, reset the property (and the cursor).
            SetCurrentClickHandler(null);
        }