Пример #1
0
        private void EndRegionSelection()
        {
            bool wasCreating = IsCreating;
            bool wasMoving   = IsMoving;

            IsCreating = false;
            IsMoving   = false;
            Form.SetDefaultCursor();

            BaseShape shape = CurrentShape;

            if (shape != null)
            {
                if (!shape.IsValidShape)
                {
                    shape.Rectangle = Rectangle.Empty;

                    UpdateCurrentHoverShape();

                    if (IsCurrentHoverShapeValid)
                    {
                        shape.Rectangle = CurrentHoverShape.Rectangle;
                    }
                    else
                    {
                        DeleteCurrentShape();
                        shape = null;
                    }
                }

                if (shape != null)
                {
                    if (Options.QuickCrop && IsCurrentShapeTypeRegion)
                    {
                        Form.UpdateRegionPath();
                        Form.Close(RegionResult.Region);
                    }
                    else
                    {
                        if (wasCreating)
                        {
                            shape.OnCreated();
                            shape.InitialSize = shape.Rectangle.Size;

                            OnShapeCreated(shape);
                        }
                        else if (wasMoving)
                        {
                            shape.OnMoved();
                        }

                        SelectCurrentShape();
                    }
                }
            }
        }
Пример #2
0
        private void UpdateCurrentShape()
        {
            BaseShape shape = CurrentShape;

            if (shape != null)
            {
                shape.OnConfigLoad();
                shape.OnMoved();
            }
        }
Пример #3
0
        private void ShapeMoved()
        {
            if (!IsCreating)
            {
                BaseShape shape = CurrentShape;

                if (shape != null)
                {
                    shape.OnMoved();
                }
            }
        }