Hi all!
This is the first time I use GoJS so I might be missing info.
I am trying to align some nodes(or a diagram?) on an image but they keep getting misplaced after I reload the page.
I am using an altered version of the DynamicPorts example (Dynamic Ports)
The changes I did are the following:
I altered the canvas html style to change the dimensions and added an image in the background.
<div id="myDiagramDiv" style="width:1200px; height:1200px; border:1px solid black;
background-image: url('rack.jpg'); background-size: cover;"></div>
I added a code to disable scrolling of the diagram.
myDiagram =
$(go.Diagram, "myDiagramDiv", //Diagram refers to its DIV HTML element by id
{ "undoManager.isEnabled": false,
allowHorizontalScroll: false,
allowVerticalScroll: false,
});
I have also removed the top and and left side navigation menu.
The issue is the following:
I add the nodes and create the links between them.
I then save in order to generate the JSON data.
I take the JSON data and put them in the “mySavedModel” text area (hardcoded in the HTML) and reload the HTML page.
The result is that all the node(or diagram altogether) is misaligned with the image. Sometimes just by a few pixels and some other times by a lot.
Any suggestions?