Closed chraibi closed 2 years ago
Hi @chraibi
Thanks for helping out in other issues by the way :) it's super helpful for me when I got other things to deal with!
To be honest I don't know why, this is imposed by the underlying JS library fabric.js. Maybe if you browse their doc you'll find out? I'm under the impression rectangle and objects are specified through x,y,height and width and maybe they followed a similar reasoning for line.
Have a nice day, Fanilo
Hi @andfanilo, I found the fabric documentation not so helpful. A simple graph showing where are the relevant points defining a line would be really nice. Anyway, I found some pointers here. It seems that the centre of line is Left-Right. (not so intuitive I would say ^^ )
My solution is, then:
xA = obj_left + obj_x1
yA = h*fig.get_dpi() - (obj_top + obj_y1)
xB = obj_left + obj_x2
yB = h*fig.get_dpi() - (obj_top + obj_y2)
Scaling and Rotating need to be considered as well, but that should not be hard.
This issue may be related to #72
First, thank you for this great software!
I'm trying to draw contours in the canvas, that I would like to export in the world coordinates.
With the following transformation:
I get the right results.
My question is: Why do I need to make the shift by
x2
andy1
? Any idea?I share here a minimal working example