Reputation: 747
I have a working paper with graph. I have added several cells to the graph and I'm trying to listen to the cell:highlight
event but I never receive it.
I'm doing:
paper.on('cell:highlight', function() { ... });
Other events seem to work fine, for example: blank:pointerup
,...
Is there something special to do to make cell events work ?
Upvotes: 3
Views: 483
Reputation: 3221
According to documentation:
cell:highlight
- triggered whenhighlight()
method is called on either an element or a link. Note that this method is also called automatically when the user is reconnecting a link and the connection is valid (validateConnection()
returns true) or ifembeddingMode
is enabled on the paper and the dragging element is above another element it could be dropped into (validateEmbedding()
returns true). The handler for this event has the following signature:function(cellView,el)
. The handler defaults tofunction(cellView, el) { V(el).addClass('highlighted') }
. In other words, the 'higlighted' CSS class is added and so you can style the highlighted element in CSS. If you want to use a different method for highlighting cells, callpaper.off('cell:highlight')
first to unregister the default handler and thenpaper.on('cell:highlight', myHandler)
to register your own.
You can read more about it here.
Upvotes: 1