Hi,
I am using a pallete in my GOJS project and I am showing the basic(Defalut)shapes and custom shapes(made from the combination of default shapes) in the pallete,Basic shapes are showing accurately but in the case of custom shapes the position of the shapes gets distorted when i show them in the pallete.
attaching the screenshots of saved shape on the canvas and on the pallete.Saved(custom) Shape:
Distorted shape on the pallete in custom shapes catagory:
Here is my code.In this i just hardcoded the json data of the saved shape in node data array.
// create the Palette for custom shapes
var customPallete =
GO(go.Palette, "customShapes");
// the Palette's node template for custom shapes
customPallete.nodeTemplate =
GO(go.Node, "Auto",
GO(go.Shape,
{
name: "SHAPE",
width: 40, height: 40,
stroke: "#000000",
fill: "transparent",
//angle: 45,
// strokeWidth: 1
},
new go.Binding("figure","fig"),
new go.Binding("location", "loc").makeTwoWay(),
new go.Binding("fill", "fill"),
new go.Binding("stroke", "stroke"),
new go.Binding("strokeWidth", "strokeWidth")
),
new go.Binding("angle", "ang").makeTwoWay(),
new go.Binding("location", "loc").makeTwoWay()
);
// the list of data to show in the Palette
customPallete.model.nodeDataArray = [
{"fig":"Square", "name":null, "key":"Shape_72", "isGroup":true},
{"fig":"LogicUnion", "key":"shape_LogicUnion_XlZ2Ivar", "geometry":null, "ang":null, "size":{"class":"go.Size", "width":70, "height":80}, "loc":{"class":"go.Point", "x":0, "y":0}, "group":"Shape_72", "spots":[], "fill":"transparent", "stroke":"black", "strokeWidth":null},
{"fig":"LineV", "key":"shape_LineV_0WncD2lL", "geometry":null, "ang":null, "size":{"class":"go.Size", "width":70, "height":70}, "loc":{"class":"go.Point", "x":158.39999999999986, "y":55.00000000000003}, "group":"Shape_72", "spots":[], "fill":"transparent", "stroke":"black", "strokeWidth":null},
{"fig":"LineV", "key":"shape_LineV_x9PPD7en", "geometry":null, "ang":null, "size":{"class":"go.Size", "width":70, "height":70}, "loc":{"class":"go.Point", "x":89.5, "y":54.99999999999997}, "group":"Shape_72", "spots":[], "fill":"transparent", "stroke":"black", "strokeWidth":null},
{"fig":"LogicUnion", "key":"shape_LogicUnion_WznJrOmZ", "geometry":null, "ang":179.7, "size":{"class":"go.Size", "width":70, "height":70}, "loc":{"class":"go.Point", "x":123.79999999999991, "y":-13.999999999999993}, "group":"Shape_72", "spots":[], "fill":"transparent", "stroke":"black", "strokeWidth":null}
]