예제 #1
0
 public void OnMouseMove(MouseEventArgs e)
 {
     if (dragHelper != null)
     {
         dragHelper.InMove(e.Location);
     }
     else if (inZoom)
     {
         // set the end point
         endPoint = drawingSurface.Transform.GetWorldPoint(e.Location);
     }
 }
        public void OnMouseMove(MouseEventArgs e)
        {
            if (dragHelper != null)
            {
                dragHelper.InMove(e.Location);
            }
            else if (drawingSurface.SelectedObject != null)
            {
                // get the world point of the mouse hit
                Coordinates worldPoint = drawingSurface.Transform.GetWorldPoint(e.Location);

                // check if the selected object is IInteract
                if (drawingSurface.SelectedObject is IMouseInteract)
                {
                    ((IMouseInteract)drawingSurface.SelectedObject).OnMouseMove(new MouseEvent(worldPoint, e.Clicks, e.Button));
                }
            }
        }
예제 #3
0
        public void OnMouseMove(MouseEventArgs e)
        {
            if (dragHelper != null)
            {
                dragHelper.InMove(e.Location);
            }
            else if (inRuler)
            {
                Coordinates worldPoint = drawingSurface.Transform.GetWorldPoint(e.Location);

                // check if the user is holding down the left mouse button
                if ((Control.ModifierKeys & Keys.Shift) != Keys.None)
                {
                    // do a hit test to get a snap point
                    // calculate hit tolerance in world units
                    double tolerance = MapSettings.PixelHitTolerance / drawingSurface.Transform.Scale;

                    // check for only selectable objects
                    HitTestResult hitResult = drawingSurface.HitTest(worldPoint, tolerance, HitTestFilters.HasSnap);

                    if (hitResult.Hit)
                    {
                        // we have a snap point
                        endPoint = hitResult.SnapPoint;
                    }
                    else
                    {
                        // no snap, just use the world point
                        endPoint = worldPoint;
                    }
                }
                else
                {
                    // not holding down the mouse button, just use the world point
                    endPoint = worldPoint;
                }
            }
        }