We have a bug with out global selections system.<br><a href="https://bugs.kde.org/show_bug.cgi?id=273260">https://bugs.kde.org/show_bug.cgi?id=273260</a><br><br>The point is, we store global selection as a KisSelection inside a KisImage object. Most of our actions like Crop/Resize/Scale the image do not take this selection into account. That is why after most of them selection becomes shifted and non-transformed. And we can't apply a visitor to it, because it is not a node.<br>
<br>I propose a solution for this problem:<br>KisImage will store a KisSelectionMask inside and will put this mask as a child to the root node. This assignment will be done in two functions setGlobalSelection() and setRootNode(). <br>
<br>After this change, all our node visitors will work as usual, they will just process all the children of the root node, so the global selection will be transformed as a regular selection mask.<br>No change will be needed for the visitors (except for some of them, those do not work with masks at all).<br>
<br>UI problem:<br>If the mask is added to the node graph, then it is shown in a KisLayerBox. So we will have to add an option to KisConfig to hide it as we do for the root layer. Actually, we may leave a way for a user to show it. It worked quite well, when i tried to add it in a hardcoded way. The only trouble i got was that it was impossible to toggle "Active" property of the mask. Everything rest was working very well.<br>
<br>Why we can't do it in another way:<br>Because all the visitors and most of the commands in Krita work with nodes. So, for example, to shift a global selection (setX(), setY() methods) we will have to create one more command. We will have to modify/duplicate all our visitors/commands to let them work with selections.<br>
<br>How it is done in other editors:<br>I tried Gimp. It transforms global selection with the image. And PS7, as far as i remember, crops the selection alongside with the image as well.<br clear="all"><br>-- <br>Dmitry Kazakov<br>