Week 7 - Working on Rotation PR and Trying Freehand Drawing#
What did you do this week?#
I continued PR #623 and fixed the displacement of the shape from its original position when applying rotation. This was happening because most of the calculations resulted in float values, but as the pixel position were integers we had to explicitly convert these values into int. This conversion rounded off the values and as we call this function continuously, each time the round-off would happen, the shape would get displaced.
To fix this, I converted all the calculations into integer calculations using floor division
// instead of normal division
The tests were failing in Ubuntu and the macOS because the mouse click event wasn’t propagated to the line due to some unknown reasons. When investigating more about the issue, Mohamed suggested and helped me implement another approach to select the shapes. In this approach, we calculate the distance between the mouse click event position and each of the shapes, and if any of the distances is less than a specific value (which I call as limit value), then we send this current event to that element.
I also tried to implement a freehand drawing mode by adding
Disk2D as points. But as you can see below, there are many flaws in this.
First of all, we add many
Disk2Dobjects which make it memory consuming process.
If the mouse moves very fast, then we can see the gaps between points.
Storing, managing, and transforming are difficult.
Did you get stuck anywhere?#
It was hard to debug why the tests were failing in Ubuntu and macOS. I tried investigating it by installing Ubuntu and got nothing, but then while implementing the new selection approach, it automatically got fixed.
What is coming up next?#
Getting PR #623 merged and working on the polyline feature.