Hi,
First of all, thank you very much for making this very useful tool.
I always had the idea in mind to make a very simple drawing app to draw, design and project stuff or just take notes while stuyding/working, but never had the time or chance to do so.
I saw this tool and I really liked the beautiful and clean UI you are making, and most of the features already implemented to make something like this work on almost any platform.
I'd like to contribute with these features I managed to implement:
- Selection Tool
- Move Tool
- Export as PNG
These features were implemented very quickly trying to follow your project flow and architecture, and focusing on simplicity.
Of course I don't to push anything: this is just my proposal for features I find useful in tools like this one and that I'm currently already using by myself, so I'll keep on using it anyway on my branch.
Since the implementations are pretty much clear from the commits, I'll directly show some examples about the results.
If you think that the way I implemented these could work, let me know how I can improve the code in order to follow your style better.
Selection tool
This new tool (with M
as the shortcut button) will let you select strokes inside a selection area, drawn pressing and holding the LEFT BUTTON
of your mouse.
The selection not only works with a single selection, but holding SHIFT
while pressing LEFT BUTTON
will allow to select different strokes with separate selection areas.
Of course, the selection area will work in all directions, and will not be influenced by the camera offset or span.
The label showing the amount of strokes selected is updated only when needed.
Move Tool
An additional tool, "Move Tool" (with shortcut button V
), has been added to the tool bar, and this will let you move around previously selected strokes.
In the same way as the Selection Tool, the Move Tool will be indipendent from camera's zoom and offset.
Export as PNG
It is now possible to export the whole canvas as a .png file.
SOME NOTES
- About Tools: I added a
CursorClass
that will be inherited by all Cursors inside the Viewport. This is not strictly necessary, but seems solid to have one just like Tools have one.
- About Selection Tool: the algorithm to select a brush stroke is very simple and cheap for now, the right compromise between performances and functionality if you ask me. It justs check if the first and last points of the stroke are inside the selection Area. Of course, it is not the best way to do this, but is very fast and it works fine for me. Eventually you already know a better way to do this, maybe more performant or more logic.
- About Move Tool: strokes are moved by the actual position of the Line2D, and not by moving each single point of the stroke. Is it ok for you? Would this create any issue with saving projects? It is the fastest way, since iterating for each point and moving it could be a problem.
- About Exporting: The FileDialog used to implement this feature is unrelated from the Saving/Loading one, since it will follow different rules and filters.
Since currently having a transparent background is not possible (I'm not able to change the alfa value, as shown in the gif), a background will be always present.
However,
Viewports
have a transparent_bg
property which can be enabled in order to have a transparent bg if the content of the viewport is saved as a file. If only making the background transparent was possible from Lorine settings (or just the Color Picker), we could have pngs with transparent background.
- Undo and Redo have not been implemented yet by me. Mostly because I don't know the effort to implement them, and if it was worth it without even knowing if any of these features would be accepted.
Thank you very much for taking your time reading this, let me know what you think about it, and eventually how these can be improved.