Hover Events in the Viewer

Hi Moderators,

I have a questionnaire about events. A few months ago there was a question about hover events. What would like to know is when a diagram element is hovered over and the there is some hatched highlighting, is it a hover event that is causing this? This may sound like a stupid question, but I have tried using the following:

var eventBus = viewer.get('eventBus');
			       eventBus.on('element.hover', function(e) {
console.log(e);		    	   if(e.element.id.startsWith("UserTask")){

If it is a hover event causing the highlighting effect in the viewer why don’t I see any output?

Thanks for any help.

Starting to look a the code, I think eventBus.on should be registering a listener, but I don’t see any in the event bus.

The highlighting is caused by the Outline service + CSS styles.

Thanks for the reply.

No listener was being registered because an error was being raised due to the diagram not being fully loaded when eventBus.on was invoked. Wrapping in setTimeout solves this problem.

Would be curious to know if the viewer supports any other event types.


It is not the viewer but rather certain components that emit and handle certain kinds of events. These are, unless documented in our examples mostly internal though.

Please checkout the Viewer source code for a list of components it is built from. Check out the individual components to learn about their events.

Thanks for your pointers nikku, I found what I was looking for.