I would like to change the black border to green when my changeColor function is called on click
I would like to know if someone can help me to find a solution because unfortunately I am stuck on it.
I thank you in advance for your answer view project
var commandsAdornment = $(
"ContextMenu",
$(
go.Panel,
"Auto",
$(go.Shape, {
fill: null,
stroke: "deepskyblue",
strokeWidth: 2,
shadowVisible: false,
}),
$(go.Placeholder)
),
$(
go.Panel,
"Horizontal",
{ defaultStretch: go.GraphObject.Vertical },
$(
"Button",
$(go.Shape, {
geometryString: "M0 0 M3 2 L3 0 7 0 7 10 3 10 3 8 M5 6 7 4 9 6 M10 0",
fill: "",
margin: 3,
}),
{ click: changeColor },
)
)
);
You could have something like this as a "ContextMenuButton" GraphObject.click event handler:
{
click: (e, button) => {
const node = button.part.adornedPart;
const shape = node.findObject("SHAPE");
if (shape) {
e.diagram.commit(diag => shape.stroke = "green");
}
}
}
This of course assumes that you have named the Shape that you want to modify with the { name: "SHAPE" } property in your node template.