Example #1
0
        private void EndRegionSelection()
        {
            bool wasCreating = IsCreating;

            IsCreating = false;
            IsMoving   = false;

            BaseShape shape = CurrentShape;

            if (shape != null)
            {
                if (!IsCurrentRegionValid)
                {
                    DeleteSelectedShape();
                    CheckHover();
                }
                else if (Config.QuickCrop && IsCurrentShapeTypeRegion)
                {
                    form.UpdateRegionPath();
                    form.Close(RegionResult.Region);
                }
                else
                {
                    if (wasCreating)
                    {
                        shape.OnShapeCreated();
                    }

                    SelectShape();

                    return;
                }
            }

            if (!CurrentHoverRectangle.IsEmpty)
            {
                AddShape(CurrentHoverRectangle);

                if (Config.QuickCrop && IsCurrentShapeTypeRegion)
                {
                    form.UpdateRegionPath();
                    form.Close(RegionResult.Region);
                }
                else
                {
                    if (wasCreating)
                    {
                        shape.OnShapeCreated();
                    }

                    SelectShape();
                }
            }
        }
Example #2
0
        private void EndRegionSelection()
        {
            bool wasCreating = IsCreating;

            IsCreating = false;
            IsMoving   = false;

            BaseShape shape = CurrentShape;

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

                    CheckHover();

                    if (IsCurrentHoverAreaValid)
                    {
                        shape.Rectangle = CurrentHoverRectangle;
                    }
                    else
                    {
                        DeleteCurrentShape();
                        shape = null;
                    }
                }

                if (shape != null)
                {
                    if (Config.QuickCrop && IsCurrentShapeTypeRegion)
                    {
                        form.UpdateRegionPath();
                        form.Close(RegionResult.Region);
                    }
                    else
                    {
                        if (wasCreating)
                        {
                            shape.OnShapeCreated();
                        }

                        SelectShape();
                    }
                }
            }
        }