示例#1
0
        public override IEventResult OnMouseMove(IMouseEventArgs e)
        {
            if (e.IsMiddlePressed)
            {
                return(EventResult.Handled);
            }

            if (_currXline != null &&
                _step == Step.Step2_SpecifyOtherPoint)
            {
                CADVector dir = (this.Pointer.CurrentSnapPoint
                                 - _currXline.basePoint).normalized;
                if (dir.X != 0 || dir.Y != 0)
                {
                    _currXline.direction = dir;
                    _currXline.Draw();
                }
            }

            return(EventResult.Handled);
        }
示例#2
0
        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);
        }