예제 #1
0
        public virtual eDrawObjectMouseDown OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snappoint)
        {
            Selected = false;
            if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Line)
            {
                Line src = snappoint.Owner as Line;
                m_p2 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p1, true);
                return(eDrawObjectMouseDown.DoneRepeat);
            }

            /*
             * if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Arc)
             * {
             *  Arc src = snappoint.Owner as Arc;
             *  m_p2 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, m_p1, 0);
             *  return eDrawObjectMouseDown.DoneRepeat;
             * }
             * */
            if (Control.ModifierKeys == Keys.Control)
            {
                point = HitUtil.OrthoPointD(m_p1, point, 45);
            }
            m_p2 = point;
            return(eDrawObjectMouseDown.DoneRepeat);
        }
예제 #2
0
파일: Line.cs 프로젝트: liyangTeam/WSXCut
 public virtual void OnMouseMove(ICanvas canvas, UnitPoint unitPoint)
 {
     if (Control.ModifierKeys == Keys.Control)
     {
         unitPoint = HitUtil.OrthoPointD(this.P1, unitPoint, 45);
     }
     this.P2 = unitPoint;
 }
예제 #3
0
 public virtual void SetPosition(UnitPoint pos)
 {
     if (m_pointId != ePoint.Center && Control.ModifierKeys == Keys.Control)
     {
         pos = HitUtil.OrthoPointD(OtherPoint(m_pointId), pos, 45);
     }
     SetPoint(m_pointId, pos, m_clone);
 }
예제 #4
0
 public virtual void OnMouseMove(ICanvas canvas, UnitPoint point)
 {
     if (Control.ModifierKeys == Keys.Control)
     {
         point = HitUtil.OrthoPointD(m_p1, point, 45);
     }
     m_p2 = point;
 }
예제 #5
0
 /// <summary>
 /// 设置点的位置
 /// </summary>
 /// <param name="pos"></param>
 public void SetPosition(UnitPoint pos)
 {
     if (Control.ModifierKeys == Keys.Control)//如果按下ctrl,则以45度角找邻点
     {
         pos = HitUtil.OrthoPointD(OtherPoint(m_pointId), pos, 45);
     }
     if (m_angleLocked || Control.ModifierKeys == (Keys)(Keys.Control | Keys.Shift))//如果角度被锁定且按下crtl或shifr则设定为点到直线最近距离直线上的点??
     {
         pos = HitUtil.NearestPointOnLine(m_owner.P1, m_owner.P2, pos, true);
     }
     SetPoint(m_pointId, pos, m_clone);//设置线上的点(p1,p2)的信息。
 }
예제 #6
0
 public void SetPosition(UnitPoint pos)
 {
     if (Control.ModifierKeys == Keys.Control)
     {
         pos = HitUtil.OrthoPointD(OtherPoint(m_pointId), pos, 45);
     }
     if (m_angleLocked || Control.ModifierKeys == (Keys)(Keys.Control | Keys.Shift))
     {
         pos = HitUtil.NearestPointOnLine(m_owner.P1, m_owner.P2, pos, true);
     }
     SetPoint(m_pointId, pos, m_clone);
 }
예제 #7
0
 public void SetPosition(UnitPoint position)
 {
     if (Control.ModifierKeys == Keys.Control)
     {
         position = HitUtil.OrthoPointD(this.OtherPoint(this.pointId), position, 45);
     }
     if (this.angleLocked || Control.ModifierKeys == (Keys)(Keys.Control | Keys.Shift))
     {
         position = HitUtil.NearestPointOnLine(this.owner.P1, this.owner.P2, position, true);
     }
     this.SetPoint(this.pointId, position, this.clone);
 }
예제 #8
0
 public virtual void OnMouseMove(ICanvas canvas, UnitPoint point)
 {
     try
     {
         if (Control.ModifierKeys == Keys.Control)
         {
             point = HitUtil.OrthoPointD(m_p1, point, 45);
         }
         m_p2 = point;
     }
     catch (Exception ex)
     { throw ex; }
 }
예제 #9
0
 public eDrawObjectMouseDown OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snappoint)
 {
     Selected = false;
     OnMouseMove(canvas, point);
     if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Line)
     {
         Line src = snappoint.Owner as Line;
         m_p2 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p1, true);
         return(eDrawObjectMouseDown.DoneRepeat);
     }
     if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Arc)
     {
         Arc src = snappoint.Owner as Arc;
         m_p2 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, m_p1, 0);
         return(eDrawObjectMouseDown.DoneRepeat);
     }
     if (snappoint is SnapPointBase && snappoint.Owner is RectBase)
     {
         NodePointCubicBezier.ePoint pointType = HitUtil.Distance(point, m_p1) < HitUtil.Distance(point, m_p2) ?
                                                 NodePointCubicBezier.ePoint.P1 : NodePointCubicBezier.ePoint.P2;
         RectBase rect = snappoint.Owner as RectBase;
         rect.AttachConnectionCrvNode(new NodePointCubicBezier(this, pointType));
         if (pointType == NodePointCubicBezier.ePoint.P1)
         {
             m_p1 = point;
         }
         else
         {
             m_p2 = point;
         }
         UpdateCtrlPts();
         return(eDrawObjectMouseDown.Done);
     }
     if (Control.ModifierKeys == Keys.Control)
     {
         point = HitUtil.OrthoPointD(m_p1, point, 45);
     }
     m_p2 = point;
     UpdateCtrlPts();
     return(eDrawObjectMouseDown.Done);
 }
예제 #10
0
 public virtual eDrawObjectMouseDownEnum OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snappoint)
 {
     try
     {
         Selected = false;
         if (snappoint is PerpendicularSnapPoint && snappoint.Owner is LineTool)
         {
             LineTool src = snappoint.Owner as LineTool;
             m_p2 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p1, true);
             return(eDrawObjectMouseDownEnum.DoneRepeat);
         }
         if (Control.ModifierKeys == Keys.Control)
         {
             point = HitUtil.OrthoPointD(m_p1, point, 45);
         }
         m_p2 = point;
         return(eDrawObjectMouseDownEnum.DoneRepeat);
     }
     catch (Exception ex)
     { throw ex; }
 }
예제 #11
0
 /// <summary>
 /// 按下鼠标时寻找点到直线最近距离直线上的点或距离园最近的点以角度找邻点
 /// </summary>
 /// <param name="canvas"></param>
 /// <param name="point"></param>
 /// <param name="snappoint"></param>
 /// <returns></returns>
 public virtual eDrawObjectMouseDown OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snappoint)
 {
     OnMouseMove(canvas, point);
     Selected = false;
     if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Rectangle)
     {
         Rectangle src = snappoint.Owner as Rectangle;
         m_p2 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p1, true);
         return(eDrawObjectMouseDown.Done);
     }
     //if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Arc)
     //{
     //    Arc src = snappoint.Owner as Arc;
     //    m_p2 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, m_p1, 0);
     //    return eDrawObjectMouseDown.DoneRepeat;
     //}
     if (Control.ModifierKeys == Keys.Control)
     {
         point = HitUtil.OrthoPointD(m_p1, point, 45);
     }
     m_p2 = point;
     return(eDrawObjectMouseDown.Done);
 }
예제 #12
0
 public virtual void OnMouseMove(ICanvas canvas, UnitPoint point)
 {
     if (CurrentPoint == eCurrentPoint.p1)
     {
         m_p1 = point;
         m_p3 = point;
         UpdateCenter();
     }
     if (CurrentPoint == eCurrentPoint.p3)
     {
         m_p3 = point;
         UpdateCenter();
     }
     if (CurrentPoint == eCurrentPoint.center)
     {
         Center = point;
     }
     if (Control.ModifierKeys == Keys.Control)
     {
         m_p3 = HitUtil.OrthoPointD(m_p1, point, 45);
         UpdateCenter();
     }
 }
예제 #13
0
파일: Line.cs 프로젝트: liyangTeam/WSXCut
 public virtual DrawObjectMouseDown OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snapPoint, MouseEventArgs e)
 {
     this.IsSelected = false;
     this.drawStatus = DrawObjectMouseDown.DoneRepeat;
     this.SN         = ++GlobalModel.TotalDrawObjectCount;
     if (snapPoint is PerpendicularSnapPoint && snapPoint.Owner is Line)
     {
         Line source = snapPoint.Owner as Line;
         this.P2 = HitUtil.NearestPointOnLine(source.P1, source.P2, this.P1, true);
         return(DrawObjectMouseDown.DoneRepeat);
     }
     //if(snapPoint is PerpendicularSnapPoint && snapPoint.Owner is Arc)
     //{
     //    Arc source = snapPoint.Owner as Arc;
     //    this.P2 = HitUtil.NearestPointOnCircle(source.Center, source.Radius, this.P1, 0);
     //    return DrawObjectMouseDown.DoneRepeat;
     //}
     if (Control.ModifierKeys == Keys.Control)
     {
         point = HitUtil.OrthoPointD(this.P1, point, 45);
     }
     this.P2 = point;
     return(DrawObjectMouseDown.DoneRepeat);
 }