Cytoscape.js Check for double Click on nodes -
i have question. there possibility bind double click mouse event node?
in documentation, there 'click'.
thanks help!
you can add custom doubletap
event cytoscape this:
var cy = $('#cy').cytoscape('get'); var tappedbefore; var tappedtimeout; cy.on('tap', function(event) { var tappednow = event.cytarget; if (tappedtimeout && tappedbefore) { cleartimeout(tappedtimeout); } if(tappedbefore === tappednow) { tappednow.trigger('doubletap'); tappedbefore = null; } else { tappedtimeout = settimeout(function(){ tappedbefore = null; }, 300); tappedbefore = tappednow; } });
then, can subscribe new event. example, if need detect double tab on nodes, do:
cy.on('doubletap', 'node', function(event) { /* ... */ });
nevertheless, understant @maxkfranz point of view not mobile-friendly solution.
Comments
Post a Comment