Esempio n. 1
0
 protected override void OnLocationChanged(EventArgs e)
 {
     base.OnLocationChanged(e);
     if (IsInDrag)
     {
         Draging?.Invoke(this, GetMouseScreenPos(), Data);
     }
 }
Esempio n. 2
0
 private void HeaderLBDown(DroppableContentControl control, MouseButtonEventArgs e)
 {
     MouseDeltaPoint       = e.GetPosition(this);
     RootTabs.AllowDropTab = false;
     ResizeMode            = ResizeMode.NoResize;
     IsHitTestVisible      = false;
     DragManager.PerformDrag(this);
     Draging?.Invoke(this, GetMouseScreenPos(), Data);
     IsInDrag = true;
     DragMove();
     FinishDrag();
     e.Handled = true;
 }
Esempio n. 3
0
 protected override void OnContentRendered(EventArgs e)
 {
     base.OnContentRendered(e);
     if (!HasInitialized)
     {
         HasInitialized = true;
         CaptureMouse();
         var deltaPos = Mouse.GetPosition(this) - MouseDeltaPoint;
         ReleaseMouseCapture();
         Left    += deltaPos.X; Top += deltaPos.Y;
         IsInDrag = true;
         if (Mouse.LeftButton == MouseButtonState.Pressed)
         {
             Draging?.Invoke(this, GetMouseScreenPos(), Data);
             DragMove(); // blocking call
         }
         FinishDrag();
     }
 }
 public bool MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (dragMode != Draging.None)
     {
         dragMode = Draging.None;
         lockPreferedAxis = false;
         return true;
     }
     return false;
 }
        public bool MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            pntDown = e.Location;

            Vector2d pnt = new Vector2d(e.X, e.Y);

            if (Control.ModifierKeys == Keys.Shift)
            {
                if ((pnt - xHandle).Length < hitDist)
                {
                    dragMode = Draging.Scale;
                    valueOnDown = this.scale.X;
                    return true;
                }

                if ((pnt - yHandle).Length < hitDist)
                {
                    dragMode = Draging.Scale;
                    valueOnDown = this.scale.Y;
                    return true;
                }

                if ((pnt - zHandle).Length < hitDist)
                {
                    dragMode = Draging.Scale;
                    valueOnDown = this.scale.Z;
                    return true;
                }
            }
            else
            {
                if ((pnt - xHandle).Length < hitDist)
                {
                    dragMode = Draging.X;
                    valueOnDown = this.translate.X;
                    return true;
                }

                if ((pnt - yHandle).Length < hitDist)
                {
                    dragMode = Draging.Y;
                    valueOnDown = this.translate.Y;
                    return true;
                }

                if ((pnt - zHandle).Length < hitDist)
                {
                    dragMode = Draging.Z;
                    valueOnDown = this.translate.Z;
                    return true;
                }
            }

            for (int i = 0; i < hprHandles.Length; i++)
            {
                if ((pnt - hprHandles[i]).Length < hitDist)
                {
                    switch (i)
                    {
                        case 0:
                            dragMode = Draging.HP;
                            valueOnDown = this.heading;
                            valueOnDown2 = this.pitch;
                            return true;
                        case 1:
                            dragMode = Draging.HP1;
                            valueOnDown = this.heading;
                            valueOnDown2 = this.pitch;
                            return true;
                        case 2:
                            dragMode = Draging.PR;
                            valueOnDown = this.pitch;
                            valueOnDown2 = this.roll;
                            return true;
                        case 3:
                            dragMode = Draging.PR1;
                            valueOnDown = this.pitch;
                            valueOnDown2 = this.roll;
                            return true;
                        case 4:
                            dragMode = Draging.RH;
                            valueOnDown = this.roll;
                            valueOnDown2 = this.heading;
                            return true;
                        case 5:
                            dragMode = Draging.RH1;
                            valueOnDown = this.roll;
                            valueOnDown2 = this.heading;
                            return true;
                        default:
                            break;
                    }
                }
            }

            return false;
        }