Thanks Walter.
What would be the best way to allow for a background image via a shape as I have in my screen shot above, but I want to give the user the ability to change the default circle background to a different shape, or get rid of the background completely. My understanding is that setting the visible property just hides the background but it is technically still there, which looks fine visually. But I would like to style the icons differently depending on if a user has included a background shape or not, if there is a background shape, and if the icon is not selected or highlighted, then I don’t need to do anything with the icon because I am already fading out the background shape and if there is a background shape then the icon needs to be white so I can leave the icon as white. But if there is no background shape, and if the node is not selected or highlighted I want to fade out the stroke of the icon.
I have an idea on how to do all that but I need to remove the background completely so that it does not exist if specified by the user. By default the background is there. It doesn’t seem to make sense to set a binding on background for the shape that is serving as a background, so just wondering if there is a way to allow for dynamically changing the background shape but at the same time having the option to remove it completely from the DOM.
//Background shape for icon 1.
graph(go.Shape, "Circle",
{name: "ICONSHAPE1", stroke: null, fill: "#009BE1", width: 25, height: 20, alignment: go.Spot.BottomLeft, minSize: new go.Size(15, 15)},
new go.Binding("visible", "hasIcon1Background", function (b) { return b ? "red" : ""}),
new go.Binding("alignment", "alignment"),
new go.Binding("margin", "icon1Margin"),
new go.Binding("height", "height"),
new go.Binding("width", "width"),
new go.Binding("figure", "icon1Background"),
new go.Binding("fill", "isHighlighted", function(h) { return h ? "#388E3C" : "#388E3C"; })
.ofObject(),
new go.Binding("fill", "isSelected", function(h) { return h ? "#388E3C" : "#009BE1"; })
.ofObject()),
//Shape/Icon for the node on the lower left of the node, default is the "ThinCross" shape built into GoJS
graph(go.Shape, "ThinCross",
{name: "ICON1", margin:2, stroke: "#FFF", strokeWidth: 2, alignment: go.Spot.BottomLeft, width: 15, height: 15},
new go.Binding("geometryString", "icon1", geoFunc),
new go.Binding("figure", "figure1"),
new go.Binding("stroke", "icon1StrokeColor")),
Thanks