Fabric.js object:selected, object not selected
You need:
canvas.on('selection:cleared', function() { ...});
Take a look at Events Demo and Events Section in tutorial.
For fabricjs 2.0 branch the events for selection on canvas should be as follows:
canvas.on('selection:created', function () { //...});canvas.on('selection:cleared', function () { //...});
the selected
event is for individual objects on canvas
var rect = new fabric.Rect({ width: 100, height: 50, fill: 'green' });rect.on('selected', function() { console.log('selected a rectangle');});