问题
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