I am using npm gojs module. Not sure it is debug one or regular one.
I think it might catch the error of trying to set Point.x or Point.y to null. - I cant see any error being logged in console, i was also debugging in chrome inspector when this operation was taking place. It did not threw any error. earlier when i tried to set location property directly. It threw some exception which was catched and logged in console.
new go.Binding("location", "Location", go.Point.parse).makeTwoWay(go.Point.stringify)
when my Location property has value null, i dont know why node’s location property has X =0 and Y =0. Is it default value for all nodes when it can not parse from Location ?
I changed position of TreeLayout to initialization part. Still not working.
Following is my complete NodeTemplate. anything wrong with it ?
return $(
go.Node, go.Panel.Auto, { padding: new go.Margin(2), movable: true }, new go.Binding("movable", "AllowMove"), new go.Binding("location", "Location", go.Point.parse).makeTwoWay(go.Point.stringify), { contextMenu: myContextMenu },
$(go.Shape, "Rectangle", new go.Binding("stroke", "isHighlighted",
function (h) { return h ? "red" : "black"; }).ofObject(), { strokeWidth: 0, fill: "transparent" }, new go.Binding("strokeWidth", "strokeWidth"), new go.Binding("strokeWidth", "isHighlighted", function (h) { return h ? 2 : 0; })
.ofObject()),
$(go.Panel, go.Panel.Auto, { defaultAlignment: go.Spot.Left },
$(go.Panel, go.Panel.Vertical, { padding: new go.Margin(2), width: 70, defaultAlignment: go.Spot.Center },
$(go.Picture, { maxSize: new go.Size(32, 32), margin: 2 }, new go.Binding("source", "ImageURI")),
$(go.TextBlock, new go.Binding("text", "FullName").makeTwoWay(), { editable: true, margin: 2, font: "12px 'Open Sans', sans-serif", textAlign: "center" }))),
{
dragComputation: stayInGroup,
selectionAdornmentTemplate: $(go.Adornment, "Auto", $(go.Shape, "Rectangle", { fill: null, stroke: "green", strokeWidth: 2 }), $(go.Placeholder)),
fromLinkableSelfNode: false, toLinkableSelfNode: false
},
MakePort("LC", go.Spot.LeftCenter, true, true),
MakePort("RC", go.Spot.RightCenter, true, true),
MakePort("TC", go.Spot.TopCenter, true, true),
MakePort("BC", go.Spot.BottomCenter, true, true),
MakePort("BL", go.Spot.BottomLeft, true, true),
MakePort("BR", go.Spot.BottomRight, true, true),
MakePort("TL", go.Spot.TopLeft, true, true),
MakePort("TR", go.Spot.TopRight, true, true),
MakePort("C", go.Spot.Center, true, true)
);