I made some changes to prevent the recalculate of wpc and hpc for every point in every resize, because it can lead to division by zero if bounding box have 0 width or height. My approach was to calculate the relative position of the point (proportion of displacement of the point based on topLeft) and reuse that proportion for calculate the new position of the points in resize instead to make this calc every time using the current size of bounding box.
I made some changes to prevent the recalculate of wpc and hpc for every point in every resize, because it can lead to division by zero if bounding box have 0 width or height. My approach was to calculate the relative position of the point (proportion of displacement of the point based on topLeft) and reuse that proportion for calculate the new position of the points in resize instead to make this calc every time using the current size of bounding box.