Update leaflet viewport when goJS viewport changes

Hello,

I need to display a map behind our goJS diagram and I have found this example: Leaflet.js and GoJS

The example updates the goJS diagram when the leaflet moveend event is fired.
I would like to update the goJS diagram even while the user is dragging/scrolling the leaflet map, so the nodes are always at their actual location. I assume this can be done but it would have an impact on performance (we might have more than 1000 nodes).

Now I was wondering if I should try it the same way as the example, or if it could be implemented the other way around:
Whenever the goJS diagram is scrolled (ViewportBoundsChanged event?), update the leaflet map viewport. This way, I wouldn’t need to update all target bindings.

Have you thought about this approach when creating the example and discarded it or do you see any issues with this approach?

If I recall correctly, we were limited by how we could interact with Leaflet.

As long as there are two independent components, there can be delays between their updates, so there can always be some temporary inconsistencies. Especially if both components need to accept input events.

But what you suggest is a good approach if you can make it work.