I am placing Text, Image and Shapes on canvas using Fabric.js. I have made Three different Edit-Panels for all three. When user select text I want to show text panel. like wise
Try isType()
Sample function for getting selected objects
function onObjectSelected(o){
//activeObject = canvas.getActiveObject()
activeObject = o.target;
if(activeObject.isType('text')){
//display text logic
}
else if(activeObject.isType('image')){
//display image
}
else if( activeObject.isType('xyz')){
//display shape logic
}
}
canvas.on('object:selected', onObjectSelected);