i have a JS app that render a rectangle with coordinate of (1,5), (3,3) (5,5),(7,3) as clockwise start from topleft . if i drag topright corner i will get new x,y that will be 4,2 so my new rect coodiates will be [1,5 ], [4,2,] [6,4][3,7]
tell me the logic to calculate this even drag is in any corner the. relate point need to be recalculated with keeping the shape as rectangle attaching a image to better understand in the image dotted line is new line after dragging TR BR and TL need to be calculated
JS code to find new coordinate from a new corner and old bbox data
At first get dimensions of the initial rectangle
Moving TR creates new vector, find it's normalized version
Now