When I click the rect, the console only prints “click the canvas” instead of “click the rect”. Is there any solution?
var rect = new fabric.Rect({
left: 100,
top: 100,
fill: 'red',
width: 100,
height: 100
});
canvas.add(rect);
rect.on('mouse:down', function(options){
console.log("click the rect");
})
canvas.on('mouse:down',function(options){
console.log("click the canvas");
})
New contributor
olivia is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.