The following list contains events that you can react on in the paper:
cell:pointerdown
- triggered when a pointer is pressed on a cell. Takes cellView
, evt
, x
and y
as arguments.cell:pointermove
- triggered when a pointer is moved on a paper and cell:pointerdown
was previously handled. Takes cellView
, evt
, x
and y
as arguments.cell:pointerup
- triggered when a pointer is released on a paper and cell:pointerdown
was previously handled. Takes cellView
and, evt
as arguments.cell:pointerdblclick
- triggered when the user double-clicks a cell. Takes cellView
, evt
, x
and y
as arguments.cell:pointerclick
- triggered when the user clicks a cell. Takes cellView
, evt
, x
and y
as arguments.cell:mouseover
- triggered when the user enters the cell view area. Takes cellView
and evt
as arguments.cell:mouseout
- triggered when the user leaves the cell view area. Takes cellView
and evt
as arguments.blank:pointerdown
- triggered when a pointer is pressed on a blank area on the paper. Takes evt
, x
and y
as arguments.blank:pointerdblclick
- triggered when the user double-clicks a blank area on the paper. Takes evt
, x
and y
as arguments.blank:pointerclick
- triggered when the user clicks a blank area on the paper. Takes evt
, x
and y
as arguments.cell:mousewheel
- triggered when the user turns their mousewheel while the cursor is over a cell in the paper. Takes evt
, x
, y
, delta
as arguments.blank:mousewheel
- triggered when the user turns their mousewheel while the cursor is over the blank area of the paper. Takes evt
, x
, y
, delta
as arguments.cell:contextmenu
- triggered when the user right-clicks a cell in the paper. Takes cellView
, evt
, x
and y
as arguments.blank:contextmenu
- triggered when the user right-clicks a blank area in the paper. Takes evt
, x
and y
as arguments.render:done
- triggered when the paper has finished rendering all the cell views in case async rendering is enabled.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.
cell:unhighlight
- triggered when unhighlight()
method is called on either an element or a link. See above the comments for cell:highlight
event for further details.link:connect
- triggered when a link is connected to a cell. Takes evt
, cellView
, magnet
, arrowhead
as arguments.link:disconnect
- triggered when a link is disconnected from a cell. Takes evt
, cellView
, magnet
, arrowhead
as arguments.paper.on('blank:pointerdown', function(evt, x, y) {
alert('pointerdown on a blank area in the paper.')
})