Use mouse traveled distance to change dimension of a 2D object

Hello, I am trying to use a transform control outline to change a 2D object shape. I am using dash-lines and points to draw an outline around an object to use them as controls. I use recasting to select the points and move them. However, I need to calculate the distance, mouse traveling to manipulate the geometry of the object to fit to the outline. Many thanks!
Screen Shot 1399-02-10 at 09.28.51
Screen Shot 1399-02-10 at 09.29.07

Here I solved the same problem, maybe it help you.

I think it should be possible to compute the scale values for your selection box by comparing the upper right point with the upper left point (x-scale) and the upper right point with the bottom right point (y-scale).

You can then apply the same scale values to your circle. Assuming it’s an instance of Object3D and the circle lies in the XY plane, you can set the scale values to the respective scale property.

1 Like

Thank you! I got what you mean. It is a way of doing it by calculating the ‘points’ movements and use it to scale the object. However, I was wondering if you know how I can find the correct mouse displacement on screen. This is a fiddle of my code in case it is useful!