Fabric.js: updating the coordinates when the polygon is moved?

Created on 1 Mar 2018  Â·  9Comments  Â·  Source: fabricjs/fabric.js

scenario:
I will change the location of the polygon after creating the polygon (selectable). Send the coordinates after the change is complete.

problem:
reads the first coordinates of the created polygon. not the coordinates at the current location.

Most helpful comment

If you can upvote the answer, someone will find it easier next time.

All 9 comments

This is a recurring problem and request.
Polygon has been answered on stackoverflow, and the line is very similar.

Since a line can be done with a polyline and polygon and polyline share the same class, at this point i ll probably add a method to calculate them.

Meanwhile please try to look on stackoverow or in the closed issue here i m sure we answered.

you say " there is no solution for now."
Did I get right?.

i posted the solution somewhere either in this issue tracker on
stackoverflow.

I do not remember when and where.

On 1 Mar 2018 10:09 am, "volkanciloglu" notifications@github.com wrote:

you say you do not have a solution for now.
Did I get right?.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/kangax/fabric.js/issues/4775#issuecomment-369525608,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABI4QGwCtuT7r921sgZMj5S5M9yqLvU6ks5tZ7rCgaJpZM4SX5ck
.

Thank you. I get it now. My English is not very good.

When you find something related to this, could you please notify? @volkanciloglu
I will do the same

fabricjs polygon points search on stack overflow, on of the top results was good

https://stackoverflow.com/questions/38999034/how-does-transforming-points-with-a-transformmatrix-work-in-fabricjs#

the accepted answer, contains a couple of lines that returns you the updated points in canvas coordinates

If you can upvote the answer, someone will find it easier next time.

@asturur Would you please give me some advice on my case?
I have tried the link you mentioned above but it didn't work.
here is my code: https://jsfiddle.net/ckitisak/3rwv1ae9/20/

I also have posted my question in SO.
https://stackoverflow.com/questions/62296638/how-to-update-the-hand-draw-polygon-position-after-moving-it

Thank you

http://fabricjs.com/custom-controls-polygon

Look for how the exact same functionality is obtained here. Version 4 used in your fiddle has been created exactly to solve those problems

Was this page helpful?
0 / 5 - 0 ratings