I am trying to create tooltips for sequence flow elements, so that they will be displayed when user places mouse on the element with the below code, but tooltips are displaying on expected position if the diagram is small, but when the diagram is large and if I scroll to the right and places mouse on the sequence flow element, then tool tip is displaying elsewhere. Any suggestions to display tooltip on exact mouse position?
var tooltips = bpmnModeler.get("tooltips");
if(e.element.type == 'bpmn:SequenceFlow' && typeof tooltips !== 'undefined') {
var businessObject = e.element.businessObject;
var value ='TOOLTIP TEXT';
var toolTipText = '<div style="width: 300px; color: black;">' + value + '</div>';
tooltips.remove(toolTipId);
toolTipId = null;
var xx = e.originalEvent.layerX + 5;
var yy = e.originalEvent.layerY + 5;
toolTipId = tooltips.add({
position: {
x: xx,
y: yy
},
id: 'toolTipId',
timeout : 1000,
html:toolTipText
});
}