- Add an object to a fabric canvas
- call object.center()
- error: /
It seems the object is now in two places. It's visually rendered in the center, but the mouse cursor sees it as in its original position. If you click on the original position, the canvas updates properly and things behave as normal.
canvas.calcOffset()
doesn't fix it (as it did here).
- Add an object to a fabric canvas
- call object.center()
- error: http://jsfiddle/tBnfL/
It seems the object is now in two places. It's visually rendered in the center, but the mouse cursor sees it as in its original position. If you click on the original position, the canvas updates properly and things behave as normal.
canvas.calcOffset()
doesn't fix it (as it did here).
2 Answers
Reset to default 19Turns out this is an open issue in fabricjs:
https://github./kangax/fabric.js/issues/642
The solution is to call object.setCoords()
after changing the object's position.
The above has not worked for me, but the following code works fine
canvas.renderAll();