Trying to set link color to transparent

Hi there,

I am trying to have an option to make the backround link of the pathparttern transparent in the form of a checkbox or a true/false dropdown in the inspector. but fail to set the property. please help.

var genericLinkTemplate =
$(go.Link, // slightly curved, by default
{
corner: 10,
fromSpot: go.Spot.AllSides, routing: go.Link.Orthogonal, curve: go.Link.JumpOver, toSpot: go.Spot.AllSides, resegmentable: true,
reshapable: true, relinkableFrom: true, relinkableTo: true, toEndSegmentLength: 20,
}, // users can reshape the link route
$(go.Shape, // the link’s path shape
new go.Binding(“stroke”, “bgTransparent”, function (f) { return (f === “true”) ? “stroke” : “transparent” }).makeTwoWay(),
));

//inspector
var inspector = new Inspector(‘myInspectorDiv’, myDiagram,
{
properties: {
“bgTransparent”: {
defaultValue: “false”,
show: Inspector.showIfLink, type: ‘select’,
choices: [“true”, “false”]
},
}
});

Your Binding conversion function is returning the value “stroke” for the link’s Shape.stroke. But that is not a valid CSS color.

I believe if you are using go-debug.js you will see a warning message in the console about this.

Here was my solution:
link:
$(go.Shape, // the link’s path shape
new go.Binding(“stroke”, “”, strokeTransparency).makeTwoWay(),

inspector:
“bgTransparent”: {
show: Inspector.showIfLink, type: ‘select’, defaultValue: “false”,
choices: [“true”, “false”]
},

method

function strokeTransparency(link) {
if (!link.lineStyle) return null;
if (link.bgTransparent === “true”) {
return “transparent”;
}
else {
return link.backgroundColor
}
}