Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

frabric js freedrawing, get a reference to the object draw

When using fabricjs in free draw mode, you can brush paths. Is there a way to get a reference as object to these paths, immediately after it is drawn? Example on mouse up get the object:

canvas.on('mouse:up', function(options) {
    var lastfreedraw = options.getLastFreeObject();
});
like image 600
albanx Avatar asked Jul 13 '13 08:07

albanx


1 Answers

Considering the info on freedraw and events I would suggest subscribing to the path:created object. Something like

canvas.on('path:created', function(e){
    var your_path = e.path;
    // ... do something with your path
});

should do.

like image 102
havarc Avatar answered Sep 28 '22 00:09

havarc