Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove borders and corners from Canvas object? [Fabric.js]

I'm using fabric.js in one project, where user can draw on canvas, and save to png image (using canvas.toDataURL() function). However, we noticed if user moved an object and clicked on Save button, it saves a border and corners of previously moved object (borders are always displayed when you move or resize object). So we need a way to remove object borders before saving, is that possible?

like image 968
donkeykong Avatar asked Dec 12 '22 05:12

donkeykong


1 Answers

Yes. You probably want to deactivate all objects before saving an image:

canvas.deactivateAll().renderAll();

(renderAll updates actual visual state after deactivation of all objects)

like image 75
kangax Avatar answered Dec 14 '22 18:12

kangax