fabricjs - Is there a method for recalculating/updating the bounding rect of an object in fabric.js? -
i trying make modifiable cubic bezier curve in fabric.js. problem have when update curve dragging control points, bounding rectangle of curve not update.
i have (ugly) code here: http://codepen.io/andershj/pen/pbwqzx?editors=1000
as can see example, bounding rect not update after updating curve.
is there method updating/recalculating bounding rect?
... canvas.on({ 'object:modified' : onobjectmodified }); function onobjectmodified(e) { canvas.setactiveobject(e.target.line.curve); // there method recalculate bounding rect when object modified? } ...
it's bit tricky can solve this:
function onobjectmodified(e) { e.target.line.curve.pathoffset = null; e.target.line.curve._setpositiondimensions({}); canvas.setactiveobject(e.target.line.curve); }
Comments
Post a Comment