salgum1114/react-design-editor

How to handle position of Polygon over the image ?

Opened this issue · 2 comments

Hi,

I'm currently trying to use this module for adding polygons overlay on image.
I'm having coordinates of the polygons in this format :

{'0004-0053': {'type': 'polygon', 'x': [633, 430, 426, 426, 430, 433, 434, 440, 441, 444, 444, 446, 449, 450, 457, 458, 463, 465, 475, 478, 503, 513, 542, 546, 570, 577, 579, 582, 583, 585, 591, 593, 600, 601, 604, 605, 614, 618, 625, 629, 633], 'y': [0, -1, 0, 8, 19, 21, 26, 33, 47, 54, 58, 59, 67, 76, 85, 89, 93, 101, 106, 104, 104, 100, 103, 101, 99, 91, 85, 83, 75, 71, 66, 57, 51, 41, 39, 35, 27, 16, 9, 8, 4], 'n': 41, 'width': 1, 'name': '0004-0053', 'position': 0}}

So I can draw the polygon properly it seems using the JSON "upload" function, but I cannot get it to adjust the position properly over the image ? Those X and Y coordinates should be enough ?

CleanShot 2021-08-13-IDnSTUkP@2x

Willing to remunerate/pay for any help on this !
Thank you very much

If you want to change it on your own: the possibility to move the points of a polygon is shown here
http://fabricjs.com/custom-controls-polygon

the editor just needs some modification

Created a fork of this project, but first of all i will only create a repo for the image editor https://github.com/AndreasBurbach/react-image-design-editor