warpdesign
warpdesign

Reputation: 747

Cell events are not triggered

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

Answers (1)

Andrey Tretyak
Andrey Tretyak

Reputation: 3221

According to documentation:

cell:highlight - triggered when highlight() 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 if embeddingMode 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 to function(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, call paper.off('cell:highlight') first to unregister the default handler and then paper.on('cell:highlight', myHandler) to register your own.

You can read more about it here.

Upvotes: 1

Related Questions