public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SelectObjects: break; case Step.Step2_SpecifyBasePoint: if (e.IsLeftPressed) { _pathLine.startPoint = this.Pointer.CurrentSnapPoint; _pathLine.endPoint = _pathLine.startPoint; _pathLine.Draw(); _step = Step.Step3_SpecifySecondPoint; } break; case Step.Step3_SpecifySecondPoint: if (e.IsLeftPressed) { _pathLine.endPoint = this.Pointer.CurrentSnapPoint; FinishOneCopyAction(); } break; default: break; } return(EventResult.Handled); }
public override IEventResult OnMouseUp(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SelectObjects: if (e.ChangedButton == MouseButton.Right && e.ButtonState == MouseButtonState.Released) { if (_mgr.presenter.selections.Count > 0) { _step = Step.Step2_SpecifyBasePoint; InitializeItemsToCopy(); this.Pointer.mode = PointerModes.Locate; } else { _mgr.CancelCurrentCommand(); } } break; case Step.Step2_SpecifyBasePoint: break; case Step.Step3_SpecifySecondPoint: break; default: break; } return(EventResult.Handled); }
public IEventResult OnMouseUp(IMouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left && e.ButtonState == MouseButtonState.Released) { if (SelRect.Active) { List <Selection> sels = SelRect.Select(_drawing.CurrentBlock); if (sels.Count > 0) { if (e.IsShiftKeyDown()) { (_drawing.Document as Document).Selections.Remove(sels); } else { (_drawing.Document as Document).Selections.Add(sels); } DrawSelection(sels, e.IsShiftKeyDown()); } } SelRect.Reset(); Draw(); } _snapNodesMgr.OnMouseUp(e); return(null); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SpecifyStartPoint: if (e.IsLeftPressed) { _polyline = presenter.AppendEntity(new Polyline(), DBObjectState.Unconfirmed); _polyline.AddVertexAt(_polyline.NumberOfVertices, this.Pointer.CurrentSnapPoint); _line = presenter.AppendEntity(new Line(), DBObjectState.Unconfirmed); _line.startPoint = _line.endPoint = this.Pointer.CurrentSnapPoint; _line.Draw(); _step = Step.Step2_SpecifyOtherPoint; } break; case Step.Step2_SpecifyOtherPoint: if (e.IsLeftPressed) { _polyline.AddVertexAt(_polyline.NumberOfVertices, this.Pointer.CurrentSnapPoint); _polyline.Draw(); _line.startPoint = this.Pointer.CurrentSnapPoint; _line.Draw(); } break; } return(EventResult.Handled); }
public override IEventResult OnMouseUp(IMouseButtonEventArgs e) { if (_step == Step.Step1_SelectObjects) { if (e.ChangedButton == MouseButton.Right && e.ButtonState == MouseButtonState.Released) { if (_mgr.presenter.selections.Count > 0) { _step = Step.Step2_SpecifyBasePoint; InitItems(); this.Pointer.mode = PointerModes.Locate; } else { _mgr.CancelCurrentCommand(); } } } else if (_step == Step.Step2_SpecifyBasePoint) { } else if (_step == Step.Step3_SpecifySecondPoint) { } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (_step == Step.Step1_SpecifyCenter) { if (e.IsLeftPressed) { _circle = Drawing.AppendEntity(new Circle(), DBObjectState.Unconfirmed); _circle.center = this.Pointer.CurrentSnapPoint; _circle.radius = 0; _circle.LayerId = this.document.currentLayerId; _circle.Color = this.document.currentColor; _step = Step.Step2_SpecityRadius; } } else if (_step == Step.Step2_SpecityRadius) { if (e.IsLeftPressed) { _circle.radius = (_circle.center - this.Pointer.CurrentSnapPoint).Length; _circle.LayerId = this.document.currentLayerId; _circle.Color = this.document.currentColor; _mgr.FinishCurrentCommand(); } } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (_step == Step.Step1_SelectObjects) { } else if (_step == Step.Step2_SpecifyBasePoint) { if (e.IsLeftPressed) { _pathLine.startPoint = this.Pointer.CurrentSnapPoint; _pathLine.endPoint = _pathLine.startPoint; _pathLine.Draw(); _step = Step.Step3_SpecifySecondPoint; } } else if (_step == Step.Step3_SpecifySecondPoint) { if (e.IsLeftPressed) { _pathLine.endPoint = this.Pointer.CurrentSnapPoint; _mgr.FinishCurrentCommand(); } } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SpecifyPoint1st: if (e.IsLeftPressed) { _point1st = this.Pointer.CurrentSnapPoint; _step = Step.Step2_SpecifyPoint2nd; } break; case Step.Step2_SpecifyPoint2nd: if (e.IsLeftPressed) { _point2nd = this.Pointer.CurrentSnapPoint; this.UpdateRectangle(); _rectangle.Draw(); _mgr.FinishCurrentCommand(); } break; } return(EventResult.Handled); }
public IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Pressed) { m_MiddleBtnPressed_Point = new CADPoint(e.X, e.Y); } return(null); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SpecifyCenter: if (e.IsLeftPressed) { _arc = presenter.AppendEntity(new Arc(), DBObjectState.Unconfirmed); _arc.center = this.Pointer.CurrentSnapPoint; _arc.radius = 0; _arc.LayerId = this.document.currentLayerId; _arc.Color = this.document.currentColor; _step = Step.Step2_SpecityStartPoint; _line = presenter.AppendEntity(new Line(), DBObjectState.Unconfirmed); _line.startPoint = _arc.center; _line.endPoint = this.Pointer.CurrentSnapPoint; _line.Draw(); } break; case Step.Step2_SpecityStartPoint: if (e.IsLeftPressed) { _arc.radius = (_arc.center - this.Pointer.CurrentSnapPoint).Length; _arc.LayerId = this.document.currentLayerId; _arc.Color = this.document.currentColor; double startAngle = CADVector.SignedAngleInRadian( new CADVector(1, 0), this.Pointer.CurrentSnapPoint - _arc.center); startAngle = MathUtils.NormalizeRadianAngle(startAngle); _arc.startAngle = startAngle; _arc.endAngle = startAngle; _step = Step.Step3_SpecifyEndPoint; } break; case Step.Step3_SpecifyEndPoint: if (e.IsLeftPressed) { double endAngle = CADVector.SignedAngleInRadian( new CADVector(1, 0), this.Pointer.CurrentSnapPoint - _arc.center); endAngle = MathUtils.NormalizeRadianAngle(endAngle); _arc.endAngle = endAngle; _arc.Draw(); _mgr.FinishCurrentCommand(); } break; } return(EventResult.Handled); }
public IEventResult OnMouseUp(IMouseButtonEventArgs e) { if (_currentCmd != null) { _currentCmd.OnMouseUp(e); } return(null); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (e.IsLeftPressed) { _mousePosInWorld = this.Pointer.CurrentSnapPoint; _mgr.FinishCurrentCommand(); } return(EventResult.Handled); }
public IEventResult OnMouseUp(IMouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Middle && e.ButtonState == MouseButtonState.Released) { _drawing.Origin = _drawing.Origin + _tempOffsetVector; _tempOffsetVector.X = 0.0; _tempOffsetVector.Y = 0.0; } return(null); }
public override IEventResult OnMouseUp(IMouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Right && e.ButtonState == MouseButtonState.Released) { if (_mgr.presenter.selections.Count > 0) { InitializeItemsToDelete(); _mgr.FinishCurrentCommand(); } else { _mgr.CancelCurrentCommand(); } } return(EventResult.Handled); }
public override IEventResult OnMouseUp(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SelectObject: if (e.ChangedButton == MouseButton.Right && e.ButtonState == MouseButtonState.Released) { if (presenter.selections.Count > 0) { foreach (Selection sel in _mgr.presenter.selections) { DBObject dbobj = database.GetObject(sel.objectId); Entity entity = dbobj as Entity; _entities.Add(entity); } this.Pointer.mode = PointerModes.Locate; _step = Step.Step2_SpecifyMirrorLinePoint1st; } else { _mgr.CancelCurrentCommand(); } } break; case Step.Step2_SpecifyMirrorLinePoint1st: break; case Step.Step3_SpecifyMirrorLinePoint2nd: break; case Step.Step4_WhetherDelSrc: break; default: break; } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SpecifyBasePoint: if (e.IsLeftPressed) { _currXline = presenter.AppendEntity(new Xline(), DBObjectState.Unconfirmed); _currXline.basePoint = this.Pointer.CurrentSnapPoint; _currXline.LayerId = this.document.currentLayerId; _currXline.Color = this.document.currentColor; this.GotoStep(Step.Step2_SpecifyOtherPoint); } break; case Step.Step2_SpecifyOtherPoint: if (e.IsLeftPressed) { CADVector dir = (this.Pointer.CurrentSnapPoint - _currXline.basePoint).normalized; if (dir.X != 0 || dir.Y != 0) { _currXline.direction = dir; _currXline.LayerId = this.document.currentLayerId; _currXline.Color = this.document.currentColor; _xlines.Add(_currXline); _currXline = Drawing.AppendEntity((Xline)_currXline.Clone(), DBObjectState.Unconfirmed); _currXline.Draw(); //_currXline = _currXline.Clone() as Xline; } } break; } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { if (_step == Step.Step1_SpecifyStartPoint) { if (e.IsLeftPressed) { _currLine = Drawing.AppendEntity(new Line(), DBObjectState.Unconfirmed); _currLine.startPoint = this.Pointer.CurrentSnapPoint; _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.LayerId = this.document.currentLayerId; _currLine.Color = this.document.currentColor; // _pointInput.Message = "指定下一点: "; _step = Step.Step2_SpecifyEndPoint; _currLine.Draw(); } } else if (_step == Step.Step2_SpecifyEndPoint) { if (e.IsLeftPressed) { _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.LayerId = this.document.currentLayerId; _currLine.Color = this.document.currentColor; _lines.Add(_currLine); _currLine = Drawing.AppendEntity(new Line(), DBObjectState.Unconfirmed); _currLine.startPoint = this.Pointer.CurrentSnapPoint; _currLine.endPoint = this.Pointer.CurrentSnapPoint; _currLine.LayerId = this.document.currentLayerId; _currLine.Color = this.document.currentColor; _currLine.Draw(); } } return(EventResult.Handled); }
public override IEventResult OnMouseDown(IMouseButtonEventArgs e) { switch (_step) { case Step.Step1_SelectObject: break; case Step.Step2_SpecifyMirrorLinePoint1st: if (e.IsLeftPressed) { // _mirrorLine = new Line(); startPoint = this.Pointer.CurrentSnapPoint; endPoint = startPoint; DrawMirrorLine(); _step = Step.Step3_SpecifyMirrorLinePoint2nd; } break; case Step.Step3_SpecifyMirrorLinePoint2nd: if (e.IsLeftPressed) { endPoint = this.Pointer.CurrentSnapPoint; DrawMirrorLine(); UpdateResultEntities(); _step = Step.Step4_WhetherDelSrc; _mgr.FinishCurrentCommand(); } break; default: break; } return(EventResult.Handled); }
public override IEventResult OnMouseUp(IMouseButtonEventArgs e) { return(EventResult.Handled); }
public virtual IEventResult OnMouseDown(IMouseButtonEventArgs e) { return(null); }
public IEventResult OnMouseDown(IMouseButtonEventArgs e) { _pos.X = e.X; _pos.Y = e.Y; Command cmd = null; switch (mode) { case PointerModes.Default: #region { if (e.IsLeftPressed) { if (_anchorMgr.currentGripPoint == null) { _pickupBox.center = _pos; List <Selection> sels = _pickupBox.Select(_drawing.CurrentBlock); if (sels.Count > 0) { //user directly clicked on entities. if (e.IsShiftKeyDown()) { (_drawing.Document as Document).Selections.Remove(sels); } else { (_drawing.Document as Document).Selections.Add(sels); } DrawSelection(sels, e.IsShiftKeyDown()); } else { //start a selection box SelRect.Active = true; SelRect.StartPoint = SelRect.EndPoint = _pos; } } else { //user selected a grip point Database db = (_drawing.Document as Document).Database; Entity entity = db.GetObject(_anchorMgr.currentGripEntityId) as Entity; if (entity != null) { GripPointMoveCmd gripMoveCmd = new GripPointMoveCmd( entity, _anchorMgr.currentGripPointIndex, _anchorMgr.currentGripPoint); cmd = gripMoveCmd; } } } } #endregion break; case PointerModes.Select: #region { if (e.IsLeftPressed) { _pickupBox.center = _pos; List <Selection> sels = _pickupBox.Select(_drawing.CurrentBlock); if (sels.Count > 0) { if (e.IsShiftKeyDown()) { (_drawing.Document as Document).Selections.Remove(sels); } else { (_drawing.Document as Document).Selections.Add(sels); } DrawSelection(sels, e.IsShiftKeyDown()); } else { SelRect.Active = true; SelRect.StartPoint = SelRect.EndPoint = _pos; } } } #endregion break; case PointerModes.Locate: CurrentSnapPoint = _snapNodesMgr.Snap(_pos); break; case PointerModes.Drag: break; default: break; } return(new EventResult() { data = cmd }); }
public IEventResult OnMouseUp(IMouseButtonEventArgs e) { return(null); }