[英]How can I “highlight” object programatically, without actually “selecting” the object
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) )
我想显示该对象的控件(句柄和边框)以使其外观为“突出显示”,但实际上并未选择该对象(这意味着不做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 :)
预先感谢大家:)
So I found the solution : 所以我找到了解决方案:
fabric.Object.prototype.highlight = function(){
this.canvas._setActiveObject(this);
};
and then just use like: obj.highlight(); 然后就像这样使用:obj.highlight();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.