コード例 #1
0
        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();
        }
コード例 #2
0
 private void CanvasOnMouse2DDragged(object sender, Mouse2DEventArgs me)
 {
     if (node != null)
     {
         RequestMutex();
         // start drag and drop
         DataObject dao = new DataObject();
         dao.SetData(typeof(INode), node);
         DragDrop.DoDragDrop(InputModeContext.CanvasControl, dao, DragDropEffects.Link | DragDropEffects.Copy | DragDropEffects.Move);
         node = null;
         ReleaseMutex();
     }
 }
コード例 #3
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);
        }
コード例 #4
0
 private void UpdateLensLocation(object sender, Mouse2DEventArgs args)
 {
     InputModeContext.CanvasControl.Invalidate();
 }
コード例 #5
0
 private void CanvasOnMouse2DReleased(object sender, Mouse2DEventArgs me)
 {
     Cancel();
 }
コード例 #6
0
 private void UpdateLensVisibility(object sender, Mouse2DEventArgs args)
 {
     mouseInside = args.EventType == Mouse2DEventTypes.Entered;
     InputModeContext.CanvasControl.Invalidate();
 }