bramp / js-sequence-diagrams

Draws simple SVG sequence diagrams from textual representation of the diagram
https://bramp.github.io/js-sequence-diagrams/
BSD 2-Clause "Simplified" License
7.81k stars 1.08k forks source link

support clicking #182

Open aiai5251 opened 7 years ago

aiai5251 commented 7 years ago

How can I support clicking every text tab?

Bilaltariq98 commented 6 years ago

I needed to support clicking on the "participant" (nodes) and managed to extract it by doing the following:

// Getting all the available "participants" - could alternatively adjust to select notes, signals etc.  
var actors = document.getElementsByClassName('actor');

// Making the first participant have an onClick event, could alternatively for loop
actors[0].style.cursor = 'pointer';
actors[0].onclick = () => {
 console.log(actors[0].textContent);
}

Hope this helps!