2

So I have this situation:

I have an object in the canvas which is deselected. I would like to show the object's controls (handles and borders) to give the appearance of it being "highlighted" but not actually selecting the object (meaning not doing canvas.setActiveObject(obj) )

Just want to be able to show the object's controls, that's it.

What I tried was doing this :

fabric.Object.prototype.highlight = function(){      
        this.hasControls = true;
        this.dirty = true;
        this.canvas.renderAll();
    };

but no luck. Thanks to everyone in advance :)

faniva
  • 320
  • 2
  • 10

1 Answers1

2

So I found the solution :

fabric.Object.prototype.highlight = function(){
   this.canvas._setActiveObject(this);
};

and then just use like: obj.highlight();

faniva
  • 320
  • 2
  • 10