Various assistant tool improvements
Note:
This is after MR !1343 (merged) . It didn't make sense to me to start it over a master since I plan some big changes.
Todo (to remember):
-
remember editor widgets in .kra files
What was done:
List of needed icons: https://phabricator.kde.org/T15540
- Remember last used assistant type when closing Krita
- Don't create an assistant/handle when the user clicked within the editor widget, that's confusing
- Allow moving around the little assistant editor widgets (the one that show up on the canvas). https://imgur.com/tH5K81m
- Fix thick lines on creating a 2pp assistant
- Add drawX and drawError functions to KisPaintingAssistant since they can be useful to many assistants (and they were a copy-pasted code between Perspective and PerspectiveEllipse assistants).
- Move some more common code to PerspectiveBasedAssistantHelper class and KisAlgebra2D, mostly calculations.
- Move "follow brush position" code to KisPaintingAssistant.
Test Plan
- Open Krita, create a Ruler, close Krita, open it again and confirm that the default assistant type is Ruler.
- Open Krita, create an assistant, click on the edges of the editor widget - it should only create an assistant when you are out of the editor widget
- On different assistants, move the assistant editor widgets using the last icon (the one with dots).
- Switch to brush tool, switch to the assistant tool again: they should stay where the user left them.
- Edit the assistant: currently, they will move, since what is remembered is not their absolute location, but the offset to the center of the assistant (so if the center of the assistant moves, the editor widget moves too) (not expected, but shouldn't be a big issue)
- Move the assistant, the editor widget should move with it (expected)
- Create a 2pp assistant. If the assistant during creation doesn't have weirdly thick lines, then it's good.
- Create a Perspective and Perspective Ellipse assistants, move them around, look at the vanishing points (they should appear and look fine) and look at what happens when you create a wrong state for the assistant (one vertex is inside the assistant) (it should be red).
- Create a Perspective and Perspective Ellipse assistants, move handles around, see that all the calculations still work.
- Create any assistant with "parallelism" (aka anything with preview following the mouse cursor). Check that the behaviour is still correct, and while painting the preview doesn't follow the brush but the new adjusted position (for example when you create a Concentric Ellipse and start painting in once place and then (still during painting) move towards the center of the ellipse and back (as if choosing bigger and smaller ellipses), the preview ellipse stays in place instead of following your cursor; so, the preview ellipse shows the actual ellipse that will be painted, since the size of the ellipse is set in stone after the user started painting).
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.
Edited by Agata Cacko