Hi There,
I separated my color properties to background color and the fore ground color, so what I want to achive is to set the foreground color stroke on the path pattern but with no luck. please help.
var inspector = new Inspector(‘myInspectorDiv’, myDiagram,
{
properties: {
“backgroundColor”: { show: Inspector.showIfLink, type: ‘color’, defaultValue: “Pink” },
“foregroundColor”: { show: Inspector.showIfLink, type: ‘color’, defaultValue: “Green”, },
“patt”: { show: Inspector.showIfLink, type: “select”, defaultValue: “Single”, choices: linkStyles },
“fromArrow”: { show: Inspector.showIfLink, defaultValue: “Circle”, type: “select”, choices: fromArrowHeads },
“toArrow”: { show: Inspector.showIfLink, type: “select”, defaultValue: “Standard”, choices: toArrowHeads },
}
});
//link properties
$(go.Shape, // the link’s path shape
new go.Binding(“stroke”, “backgroundColor” ).makeTwoWay(),
new go.Binding(“strokeWidth”, “width”).makeTwoWay(),
new go.Binding(“pathPattern”, “patt”, convertPathPatternToShape, new go.Binding(“stroke”, “foregroundColor”).makeTwoWay()),
),
function definePathPattern(name, geostr, color, width, cap) {
if (typeof name !== ‘string’ || typeof geostr !== ‘string’) throw new Error("invalid name or geometry string argument: " + name + " " + geostr);
if (color === undefined) color = “black”;
if (width === undefined) width = 1;
if (cap === undefined) cap = “square”;
PathPatterns.add(name,
$(go.Shape,
{
geometryString: geostr,
fill: “transparent”,
stroke: color,
strokeWidth: width,
strokeCap: cap
}
));
}
function convertPathPatternToShape(name) {
if (!name) return null;
return PathPatterns.getValue(name);
}