Creating a rectangle in FabricJs is straightforward using top
, left
, width
and height
values.
After moving, scaling and rotating the rectangle around, one can get the rectangle's definitive coordinate using the aCoords
of the object, returning bl
, br
, tl
, tr
x and y coordinates of the rectangles four edges.
How can one recreate the same rectangle using only these four coordinates, which also include rotation and scaling?
I was only able to recreate the rectangle after it has been moved and scaled, but not with rotations.
This above image is a screenshot of the following jsFiddle: https://jsfiddle.net/7neukojd/32/
As you can see, the left side is the original rectangle (blue), which has been scaled, moved and rotated. The right side rectangle (red) is me, trying to copy it using only the bl
, br
, tl
and tr
coordinates.
question from:
https://stackoverflow.com/questions/65919183/fabricjs-create-rectangle-using-4-points-tl-tr-bl-br 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…