Hi Prasanth,
You can react on the element:pointerdown event on paper and show/hide any other elements. Here's an example of showing/hiding embedded elements on click:
// Toggle our custom 'hidden' property on all embedded cells:
paper.on('element:pointerdown', function(cellView, evt, x, y) {
var cell = cellView.model;
var embeddedCells = cell.getEmbeddedCells();
_.each(embeddedCells, function(child) {
child.set('hidden', !child.get('hidden'))
})
})
// React on changes in the 'hidden' property and show/hide the cell for which the property has changed.
// Note that all changes bubble up to the graph so we don't have to listen on all the cells separately.
// Instead, we can have just one handler for the change:hidden event on the graph.
graph.on('change:hidden', function(cell, changed, opt) {
cell.attr('./opacity', cell.get('hidden') ? 0 : 1);
})