fabricjs对象/画布手动触发事件 [英] fabricjs object / canvas fire an event manually
问题描述
我想手动触发* 在画布事件上选择对象* -在对象区域中单击鼠标并选中对象时触发的同一事件-控件变为可见
i want to manually trigger *select object on the canvas event * - the same event that fires when a mouse click was made within an object area, and the object become selected - the controls become visible.
因此,换句话说,我想手动显示画布上指定对象的控件,而无需用户/鼠标交互.有帮助吗?
so in other words, i want to show controls for a specified object on the canvas MANUALLY, without user/mouse interaction. any help ?
推荐答案
解决方案.
如果有人在寻找答案-
fabric.Canvas.setActiveObject(fabric.Object) ...
如何找到解决方案:
我知道错误的想法是照顾'object:selected'之前的事件,但是没有这样的事件!所以我意识到我所要做的只是看'object:selected'
的代码,这就是我发现哪个方法触发它的方法……在
how the solution was found:
i understood that the wrong thinking was to look after the event that precedes the 'object:selected', but there is no such event !!! so i realized that all what i had to do is just look in the code for 'object:selected'
and that's how i found which method fires it ... also it is well documented here, in docs .
建议:很高兴在文章中-getActiveObject / Group
旁边注明.当前仅显示在此处- http://fabricjs.com/customization/
suggestion: would be great to note about it in the articles - next to getActiveObject / Group
. currently it appears only here - http://fabricjs.com/customization/
无论如何,cangax和其他参与者-非常喜欢您的工作! 谢谢
anyway, cangax and others participators - like very much your work ! thanks
这篇关于fabricjs对象/画布手动触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!