Hello,
I have succeeded in importing the diagram from the JSON file and restoring the positions of the nodes.
It’s working by adding the flags:
isOngoing: false
isInitial: false
(Both of them are needed)
BUT - the above flag broke the drag of the nodes - even WITHOUT import. I got the error:
go-debug.js:15 Uncaught Error: findObjectAt: Point must have a real value, not: Point(NaN,NaN)
at v (go-debug.js:15:115)
at t.mc (go-debug.js:615:103)
at Ef (go-debug.js:687:159)
at Ne.findDragOverObject (go-debug.js:376:270)
at tf (go-debug.js:375:144)
at Ne.doMouseMove (go-debug.js:384:473)
at Q.doMouseMove (go-debug.js:666:529)
at Ii.a.pk (go-debug.js:661:209)
I’m using AlignedLayeredDigraphLayout with the following definitions:
// ================================== Diagram initial settings ================================== //
const buildDiagramInitSettings = () => ({
allowCopy: false,
allowGroup: false,
allowInsert: false,
allowLink: false,
allowTextEdit: false,
initialContentAlignment: go.Spot.Center,
initialAutoScale: go.Diagram.Uniform,
scrollMode: go.Diagram.InfiniteScroll,
‘animationManager.isEnabled’: false, // turn off automatic animations
layout: $(AlignedLayeredDigraphLayout, {
columnSpacing: 15,
layerSpacing: 100,
linkSpacing: 150,
layeringOption: go.LayeredDigraphLayout.LayerOptimalLinkLength,
aggressiveOption: go.LayeredDigraphLayout.AggressiveMore,
initializeOption: go.LayeredDigraphLayout.InitDepthFirstIn,
packOption: go.LayeredDigraphLayout.PackStraighten,
setsPortSpots: false,
isRealtime: false,
isOngoing: false, <-NEW
isInitial: false, <-NEW
}),
});
// =======================================
and with the following code of assign layers:
Note: the original data (not the exported to JSON one) does not include the positions of the nodes - it was managed automatically internally by the package.
How can I deal with it?