예제 #1
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (IsPanning)
     {
         e.Handled = true;
         var delta = LastPanPos - LayoutTransform.Transform(e.GetPosition(this));
         Scroller.ScrollToHorizontalOffset(Scroller.HorizontalOffset + delta.X);
         Scroller.ScrollToVerticalOffset(Scroller.VerticalOffset + delta.Y);
     }
     if (TempLine.Visibility == Visibility.Visible)
     {
         e.Handled = true;
         if (StartNode.Node.GetConnectionType() == INodeConnectionType.INPUT)
         {
             TempLine.Redraw(e.GetPosition(this), ConnectionStartPos);
             TempLine.SetCanvasPos(e.GetPosition(this), ConnectionStartPos);
         }
         else
         {
             TempLine.Redraw(ConnectionStartPos, e.GetPosition(this));
             TempLine.SetCanvasPos(ConnectionStartPos, e.GetPosition(this));
         }
     }
 }
예제 #2
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            e.Handled = true;
            // Keyboard.ClearFocus();
            //IsPanning = true; //TODO:
            LastPanPos = LayoutTransform.Transform(e.GetPosition(this));

            //Added by Shakeel to set a module inactive
            if (e.OriginalSource == this)
            {
                var activeModule = this.Children.OfType <CanvasModule>().FirstOrDefault(x => x.IsActive);

                if (activeModule != null)
                {
                    activeModule.IsActive = false;
                }
            }
        }