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); }
public virtual void OnMouseMove(ICanvas canvas, UnitPoint unitPoint) { if (Control.ModifierKeys == Keys.Control) { unitPoint = HitUtil.OrthoPointD(this.P1, unitPoint, 45); } this.P2 = unitPoint; }
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); }
public virtual void OnMouseMove(ICanvas canvas, UnitPoint point) { if (Control.ModifierKeys == Keys.Control) { point = HitUtil.OrthoPointD(m_p1, point, 45); } m_p2 = point; }
/// <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)的信息。 }
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); }
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); }
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; } }
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); }
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; } }
/// <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); }
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(); } }
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); }