Text: Implement cross layer shape selection for the text tool.
A request from artists, this helps navigate complex compositions like comics by allowing the text tool to enter text editing mode for any text shape on an editable layer anywhere in the image.
This adds two new (and one helper) functions to KisToolUtils:
- shapeHoverInfoCrossLayer will retrieve information useful for hovering.
- selectShapeCrossLayer will select the layer and shape under the cursor.
- findShapeLayers is the utility function to find shapes. It is similar to findNodes, though it uses shapeAt for finding the shape layers.
The shape itself is not returned by these functions as it is possible to do silly things with said shape, like selecting it on a different layer's shape selection (as my first experiments ended up).
The function is set up so shape edit and selection could use it, but not implemented yet as these tools can select multiple shapes and more care needs to be taken to keep that intuitive.
Test Plan
Get an image with text shapes on different layers and select the text tool.
- Hovering over a text shape on a different layer will provide a hover outline + the writing-mode appropriate cursor.
- When clicking on a text shape on a different layer the layer will change in addition to selecting the shape.
- Clicking outside of text shapes while in text editing mode will end editing mode.
- Clicking outside of text shapes while not in text editing mode will initiate text creation.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. -
I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!) -
I made sure my commits build individually and have good descriptions as per KDE guidelines. -
I made sure my code conforms to the standards set in the HACKING file. -
I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.