Leaflet Support

I’m evaluating GoJS’s fit for an Angular 5 enterprise application. It will require graphics (routes and points) on top of Leaflet.

I’m running in to a few problems with the basics.

From the Leaflet sample at https://gojs.net/latest/samples/leaflet.html, I’m running into a problem with typing.

When setting up the on move behavior here:

myLeafletMap.on(“move”, function(e) {
myUpdatingGoJS = true;
myDiagram.updateAllTargetBindings(“latlong”); // Without virtualization this can be slow if there are many nodes
myDiagram.redraw(); // At the expense of performance, this will make sure GoJS positions are updated immediately
myUpdatingGoJS = false;
});

there appear to be two issues:

  1. updateAllTargetBindings is only parameterless in the go.Diagram ts file, and does not accept a binding member to be specified (“latlong”)
  2. there is no .redraw() in go.Diagram in the ts file. Is this an oversight or should I be using an alternate method to redraw my diagram?

I am on v 1.8.10.

Thanks.

Thank you for your bug reports. In version 1.* the TypeScript definition file was generated by hand, and indeed we missed the argument to Diagram.updateAllTargetBindings. We’ll fix this for the next release.

The Diagram.redraw method was an intentional oversight, since we did not want to document it – everyone would just be calling it whenever anything didn’t work, and then they’d leave the call in after fixing their actual bug, despite the performance penalty.

Apparently you have already worked around these flaws, so I assume it wasn’t a real impediment to your programming. Sorry about that.

Thanks again Walter.

In the “I’m updating the diagram” critical section of the map’s on.(“move”…) I’m only simply calling the parameterless updateAllTargetBindings(). I’m not calling anything else, and it appears to be working fine. So since everything is working as expected, there’s no need to call anything in the place of .redraw?

Cheers,

K

Yes, it should work, but it’s less efficient when all bindings are being re-evaluated instead of only those that need to be. Assuming that you know which properties had changed…

Thanks Walter.