forked from process-analytics/bpmn-visualization-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (22 loc) · 1.36 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Main BPMN Container
const mainBpmnContainerElt = window.document.getElementById('main-bpmn-container');
const mainBpmnVisualization = new bpmnvisu.BpmnVisualization({ container: mainBpmnContainerElt });
mainBpmnVisualization.load(getOrderFulfillmentBpmnDiagram(), { fit: {type: 'Center'} });
// Secondary BPMN Container
const secondaryBpmnContainerElt = window.document.getElementById('secondary-bpmn-container');
const secondaryBpmnVisualization = new bpmnvisu.BpmnVisualization({ container: secondaryBpmnContainerElt });
// Interaction
const modalElt = document.getElementById('modal');
let secondaryBpmnDiagramIsAlreadyLoad = false;
const callActivityElt = mainBpmnVisualization.bpmnElementsRegistry.getElementsByIds(['call_activity'])[0].htmlElement;
// in normal situation, the modal shows up on mouseover. But if there are issues with the modal loading, having a dedicated
// mouse cursor will may help user knowing something should be working on the call activity element.
mainBpmnVisualization.bpmnElementsRegistry.addCssClasses(['call_activity'], 'c-hand');
callActivityElt.onmouseover = () => {
// Display the modal
modalElt.classList.add('active');
if(!secondaryBpmnDiagramIsAlreadyLoad) {
secondaryBpmnVisualization.load(getProcurementBpmnDiagram(), { fit: {type: 'Center', margin: 10 } });
secondaryBpmnDiagramIsAlreadyLoad = true;
}
}