fabricjs object / canvas fire an event manually

不羁的心 提交于 2019-12-10 11:33:42

问题


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 ?


回答1:


solution was found in the docs.

if someone looking for the answer -

fabric.Canvas.setActiveObject(fabric.Object) ...

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 .

suggestion: would be great to note about it in the articles - next to getActiveObject / Group . currently it appears only here - http://fabricjs.com/customization/

anyway, cangax and others participators - like very much your work ! thanks



来源:https://stackoverflow.com/questions/14477281/fabricjs-object-canvas-fire-an-event-manually

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!