javascript - Bind events to object in fabricJS -


using latest fabric.js, have code:

var imageadded = new image(); imageadded.onload = function (img) {     var imgadded = new fabric.image(imageadded, {         clipname: picid,         clipto: function (ctx) {             return _.bind(clipbyname, imgadded)(ctx)         }     });     canvas.add(imgadded);      imgadded.on("object:selected", function (e) { // doesn't pass function         alert(e.target.clipname + " selected");         e.target.clipto = null;         canvas.renderall();     }); }; 
  • i want alert when select object no alert showed because function made comment in code doesn't work.
  • i tried this link still can't make possible.

i appreciate every suggestion. thank you!

if want event specific object use:

imgadded.on("selected", function(){alert(this.clipname);}); 

if want event canvas , objects:

canvas.on("object:selected", function(e){alert(e.target.clipname);}); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -