While implementing the basic AngularJS demo from the GoJS samples inside of angular-ui tabs, I am running into an issue where the diagram gets rendered, but it is stuck in the top right corner of the canvas, instead of being centered as per initialContentAlignment: go.Spot.Center
. I don’t know why the alignment does not center.
When logging out the diagram.contentAlignment
inside the scope.$watch("model", function(newmodel) {
, the x
and the y
coordinates come out as NaN
.
To fix - and this seems like an utter hack - adding this check inside the watch
seems to help.
if (isNaN(diagram.contentAlignment.x)) {
diagram.contentAlignment = go.Spot.Center;
}