I have a fabric element inside a canvas, and I want to add a dbclick event on that specific element.
customText = new fabric.Text(customTextContent, {
pp_type: 'custom_text',
pp_label: _t('my text'),
// lockUniScaling: true,
uniqId: uniqId,
fill: customColor,
fontFamily: customFont,
fontSize: 12,
scaleX: self.baseTextScale,
scaleY: self.baseTextScale
});
customText.on('mouse:dblclick', function (e){
console.log('canvas db clicked');
console.log(e);
});
What am I doing wrong ?
window.fabric.util.addListener(canvas.upperCanvasEl, 'dblclick', function (e, self) {
var target = canvas.findTarget(e);
}
Target wil contains all the specification of the clicked element. So just need to switch the bahavior considering the type or whatever the kind of condition you need.