//--------------------------------------------------------------------------------------------------

        void _OnActionPreview(ToolAction toolAction)
        {
            if (toolAction == _PointAction)
            {
                if (_Segments != null)
                {
                    _UpdateCornerPoints(_PointAction.Point);
                    foreach (var component in _Elements)
                    {
                        component.OnPointsChanged(_Points, null);
                    }

                    if (_ValueHudElement == null && _SketchEditorTool.WorkspaceController.HudManager != null)
                    {
                        _ValueHudElement                    = _SketchEditorTool.WorkspaceController.HudManager?.CreateElement <MultiValueHudElement>(this);
                        _ValueHudElement.Label1             = "Size X:";
                        _ValueHudElement.Units1             = ValueUnits.Length;
                        _ValueHudElement.Label2             = "Size Y:";
                        _ValueHudElement.Units2             = ValueUnits.Length;
                        _ValueHudElement.MultiValueEntered += _ValueHudElement_MultiValueEntered;
                    }
                    _ValueHudElement?.SetValue1(_Points[2].X - _Points[0].X);
                    _ValueHudElement?.SetValue2(_Points[2].Y - _Points[0].Y);
                }

                _Coord2DHudElement?.SetValues(_PointAction.PointOnWorkingPlane.X, _PointAction.PointOnWorkingPlane.Y);
            }
        }
Exemple #2
0
        //--------------------------------------------------------------------------------------------------

        void _FinishPivotPoint(ToolAction toolAction)
        {
            if (!(toolAction is PointAction pointAction))
            {
                return;
            }

            _ClearPreviews();

            _Plane       = WorkspaceController.Workspace.WorkingPlane;
            _PointPlane1 = pointAction.PointOnPlane;

            pointAction.Stop();
            pointAction            = new PointAction(this);
            pointAction.Previewed += _PreviewBaseRect;
            pointAction.Finished  += _FinishBaseRect;
            if (!WorkspaceController.StartToolAction(pointAction))
            {
                return;
            }

            _CurrentPhase = Phase.BaseRect;
            StatusText    = "Select opposite corner point.";

            _MultiValueHudElement = WorkspaceController.HudManager?.CreateElement <MultiValueHudElement>(this);
            if (_MultiValueHudElement != null)
            {
                _MultiValueHudElement.Label1             = "Length:";
                _MultiValueHudElement.Units1             = ValueUnits.Length;
                _MultiValueHudElement.Label2             = "Width:";
                _MultiValueHudElement.Units2             = ValueUnits.Length;
                _MultiValueHudElement.MultiValueEntered += _MultiValueEntered;
            }
        }
Exemple #3
0
        //--------------------------------------------------------------------------------------------------

        void _MultiValueEntered(MultiValueHudElement hudElement, double newValue1, double newValue2)
        {
            if (_CurrentPhase == Phase.BaseRect)
            {
                _PointPlane2 = new Pnt2d(_PointPlane1.X + newValue1, _PointPlane1.Y + newValue2);
                _FinishBaseRect(null);
            }
        }
        //--------------------------------------------------------------------------------------------------

        void _ValueHudElement_MultiValueEntered(MultiValueHudElement hudelement, double newvalue1, double newvalue2)
        {
            if (newvalue1 == 0 || newvalue2 == 0)
            {
                return;
            }

            _SetSecondPoint(_Points[0].Translated(new Vec2d(newvalue1, newvalue2)), -1);
        }
Exemple #5
0
        //--------------------------------------------------------------------------------------------------

        public override void Stop()
        {
            WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement);
            _Coord2DHudElement = null;
            WorkspaceController.HudManager?.RemoveElement(_ValueHudElement);
            _ValueHudElement = null;
            WorkspaceController.HudManager?.RemoveElement(_MultiValueHudElement);
            _MultiValueHudElement = null;

            _ClearPreviews();

            base.Stop();
        }
        //--------------------------------------------------------------------------------------------------

        public void Stop()
        {
            _PointAction.Stop();
            if (_Elements != null)
            {
                foreach (var element in _Elements)
                {
                    element.Remove();
                }
            }

            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_Coord2DHudElement);
            _Coord2DHudElement = null;
            _SketchEditorTool.WorkspaceController.HudManager?.RemoveElement(_ValueHudElement);
            _ValueHudElement = null;
        }