I am trying to render a canvas (using heatmap.js) on top of the bpmn viewer. I am able to get the (X,Y) coordinates of the elements using the elementRegistry API.
The problem is that I want to get the updated coordinates when the user performs the following operations:
scroll
pan
zoom
I tried using the getBoundingClientRect() API but it’s not giving the right coordinates.
I never looked into that (transformation matrix) all this time. Thanks for that.
Now I am able to get what I want. This is what I did. (cf. bpmn-heatmap-transform - CodeSandbox)
The viewbox.changed event is debounced by 300 ms for performance reasons. I’d suggest you hide the heatmap on viewbox.changing and show it on viewbox.changed. This is how the context pad and other overlays work, too.