Understanding the need for setCoords
#10234
Replies: 1 comment 2 replies
-
When dragging an object or when modifying it with the controls, setCoords is indeed called. ( look at canvas._performTransformAction function ) if you take an object on the canvas and you do:
Fabricjs does not do anything automatic. A scenario when you do not want setCoords updated automatically is when you are doing a lot of stuff and you do not want extra code to run that you do not need. Js is pretty flexible, if you want rewrite the FabricObject.set method in your project and make it trigger a setCoords every time one position property is updated:
Which are the situations in which you are out of sync with the coords and you need to call it manually? |
Beta Was this translation helpful? Give feedback.
-
Regarding the first Gotcha in the docs "Objects are no more selectable - setCoords" — can someone please help me understand why updating the coordinates isn't handled internally whenever left and/or top are set (like what happens automatically when adjustments are made via the dragging the object or its controls) ? What is a scenario where a developer would not want oCoords and aCoords automatically updated? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions