Yousef
Yousef

Reputation: 500

object modified event FabricJS (I-Text background color)

Is there a way to tell (immediately) when an I-Text "textBackgroundColor" is modified ?

This is my code but it only catches movement events or scales and so on, not I-Text 'fill' or 'textBackgroundColor'...

canvas.on('object:modified', function(e) {
   console.log('modification occurred')
   if (e.target.get('type') == 'i-text') {
       if (e.target.get('textBackgroundColor').length > 0) {
           console.log('background color exists');
       }
   }
}); 

Upvotes: 1

Views: 826

Answers (1)

Durga
Durga

Reputation: 15604

No it won't fire object:modified for property change. You can use canvas.fire('object:modified',{ target: object }) to manually fire event while setting property to the object.

Upvotes: 3

Related Questions