Bug 445935

Summary: Wrong/Zero selection. Less then 1 px
Product: [Applications] krita Reporter: Alexey <o-din13>
Component: Tools/SelectionAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, vitamorus.art
Priority: NOR    
Version: 5.2.6   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Not create any selections less than 1px

Description Alexey 2021-11-22 17:36:49 UTC
Created attachment 143845 [details]
Not create any selections less than 1px

If we click without drag on 1px size that make empty invisible selection.


OBSERVED RESULT
See attachment video


EXPECTED RESULT
Not create any selections less than 1px
Comment 1 Ahab Greybeard 2021-11-24 15:27:25 UTC
I can Confirm that this happens for 4.4.8 onwards, using the appimages.

It happens when using a vector selection. The vector tools can be used to set a size, in pixels, of less that 1.
Comment 2 Vitamorus 2024-11-14 10:02:47 UTC
I can reproduce this in 5.2.6.

It seems the original report was about how making a 0x0 px selection while in 'Replace'-mode will effectively act as deselecting. I assume this is intentional behaviour, but I understand if it's annoying on the occasions you misclick and you remove your selection. This is just a matter of hitting Undo (Ctrl + Z) to restore the selection, though. 

As Ahab pointed out, though, vector selection allows you to make valid selections with 0 px in width or height as long as the other length is >0. I think it'd better if, when making a selection, the selection should only be valid (i.e. generate an outline) if both the length and width are greater than 0.
Comment 3 Dmitry Kazakov 2024-11-14 13:53:11 UTC
Git commit 2485ada3de2267baa19dfd8562ed916126a7c8d0 by Dmitry Kazakov.
Committed on 14/11/2024 at 13:07.
Pushed by dkazakov into branch 'krita/5.2'.

Make vector and raster selections to behave in the same way when creating tiny selections

1) Rectangle and Ellipse selection tools should do nothing when crating 0px-wide
    selections. They just do nothing, not "deselect" action. For deselect the user should
    actually to a click.

2) When creating subtract-mode selection on empty selection, Krita should first select
    the entire image, and then remove the selected portion. This behavior existed in Krita
    since at least 2010. This patch just makes vector mode to behave consistently with
    the pixel mode.

Note: bug 408369 is almost fixed. The only issue left is the intersection mode artifacts.
Related: bug 408369

M  +20   -8    libs/ui/tool/kis_selection_tool_helper.cpp
M  +4    -0    plugins/tools/selectiontools/kis_tool_select_elliptical.cc
M  +3    -3    plugins/tools/selectiontools/kis_tool_select_rectangular.cc

https://invent.kde.org/graphics/krita/-/commit/2485ada3de2267baa19dfd8562ed916126a7c8d0
Comment 4 Dmitry Kazakov 2024-11-14 13:54:05 UTC
Git commit c3279cd2ae469615dcdf0980297e4e1420565ce1 by Dmitry Kazakov.
Committed on 14/11/2024 at 13:53.
Pushed by dkazakov into branch 'master'.

Make vector and raster selections to behave in the same way when creating tiny selections

1) Rectangle and Ellipse selection tools should do nothing when crating 0px-wide
    selections. They just do nothing, not "deselect" action. For deselect the user should
    actually to a click.

2) When creating subtract-mode selection on empty selection, Krita should first select
    the entire image, and then remove the selected portion. This behavior existed in Krita
    since at least 2010. This patch just makes vector mode to behave consistently with
    the pixel mode.

Note: bug 408369 is almost fixed. The only issue left is the intersection mode artifacts.
Related: bug 408369

M  +20   -8    libs/ui/tool/kis_selection_tool_helper.cpp
M  +4    -0    plugins/tools/selectiontools/kis_tool_select_elliptical.cc
M  +3    -3    plugins/tools/selectiontools/kis_tool_select_rectangular.cc

https://invent.kde.org/graphics/krita/-/commit/c3279cd2ae469615dcdf0980297e4e1420565ce1