InkFlow
- 3 Devlogs
- 4 Total hours
A modern infinite whiteboard application built with Python and PySide6
A modern infinite whiteboard application built with Python and PySide6
I divided the the working of the code into different pipelines
I also added new folders to organize everything I added the folders UI and tools to organize the pipelines
I divided the tools from the main Canvas.py to sub scripts in the Tools Folder, like base_tool.py and pen_tool.py
Then in canvas.py I added a simple method to check the current active tool and how to call it actively.
I implemented infinite panning, precision scroll-wheel zooming, and smoother pen aesthetics along with Infinite Canvas
The problem I faced was that
It was difficult to add support for both space bar and left click(of the mouse)
being pressed at the same time
So to solve it I introduced 3 variables self.panning = False, self.pan_start = None and self.space_pressed = False
then while checking for the key press, we check for space bar and set the variable self.space_pressed to true
and then while checking for the mouse press event we set the variable self.panning to True
And then finally in the mouse move event we actually pan in the canvas by moving the camera
self.horizontalScrollBar().setValue(Β self.horizontalScrollBar().value() - int(delta.x()))Β Β Β
self.verticalScrollBar().setValue(self.verticalScrollBar().value() - int(delta.y()))
Today I created a window on the screen that scales nicely to the userβs monitor and created a responsive digital canvas on which you can draw Lines and dots till now
I faced a problem that didnβt let me draw dots the problem was:-
clicking on the canvas without dragging the mouse left absolutely nothing on the screen.
The path-drawing logic expected continuous cursor updates to generate lines.
Tapping the screen to place a single dot was functionally invisible.
So I introduced a self.has_moved variable which is set to False by default and when the user presses the left button and moves the mouse it is set to True
then we run a Check in the release event that if has_moved = False then it draws a dot otherwise it draws a line using self.last_point and self.current_point