Binds to a mouse event occurring on a given model object. This is a wrapper around the
on event binding method, which searches for an associated model object for the given event. For instance, you might have a node template that has a button inside of it that you want to respond to. When the button is clicked you want to know the node associated with the button. This method provides that. It is possible to find the associated model object yourself, via the
getObjectInfo method of the Surface, called with the event's target, but this method does that for you.
You can, optionally, provide a type hint to this method in order to fix the type of the returned model object, but note that this is erased at runtime and the type of the returned object is not guaranteed by the surface.
This method binds a delegated event handler on the container element used by the surface. You do not need to provide an element to which to bind; you just need to provide an appropriate selector
bindModelEvent<T extends Edge | Node | Group | Port | Vertex>(event: string, selector: string, callback: ModelEventCallback<T>): void;
|event||string||Name of the event to bind to.|
|selector||string||CSS3 selector that identifies children of a vertex DOM element on which the event handler should be bound.|
|callback||ModelEventCallback<T>||Function to call when the event is fired.|