When I try it, it seems to work well. Note a few simplifications that I have made:
myDiagram.linkTemplate =
$(go.Link,
$(go.Shape, { strokeWidth: 2, stroke: "#AFB0B1" }),
$(go.Shape, { toArrow: "Standard", fill: "#AFB0B1", stroke: "#AFB0B1" } }),
$(go.Shape, "Hexagon",
{
width: 15, height: 15, fill: "transparent", strokeWidth: 0,
click: (e, shape) => {
alert(shape.part.toString())
},
mouseEnter: (e, shape) => shape.part.isHighlighted = true,
mouseLeave: (e, shape) => shape.part.isHighlighted = false
},
new go.Binding("fill", "isHighlighted", h => h ? "#48B25C" : "transparent").ofObject()
)
);
But I do notice that once the link is selected, its selection Adornment gets in the way of the mouseEnter and mouseLeave events. You could either change the link not to use a selection Adornment or you could make it un-pickable. Here’s the first choice:
myDiagram.linkTemplate =
$(go.Link,
{ selectionAdorned: false, toShortLength: 2 },
$(go.Shape, { strokeWidth: 2, stroke: "#AFB0B1" },
new go.Binding("stroke", "isSelected", s => s ? "dodgerblue" : "#AFB0B1").ofObject()),
$(go.Shape, { toArrow: "Standard", fill: "#AFB0B1", strokeWidth: 0, scale: 1.2 },
new go.Binding("fill", "isSelected", s => s ? "dodgerblue" : "#AFB0B1").ofObject()),
$(go.Shape, "Hexagon",
{
width: 15, height: 15, fill: "transparent", strokeWidth: 0,
click: (e, shape) => {
alert(shape.part.toString())
},
mouseEnter: (e, shape) => shape.part.isHighlighted = true,
mouseLeave: (e, shape) => shape.part.isHighlighted = false
},
new go.Binding("fill", "isHighlighted", h => h ? "#48B25C" : "transparent").ofObject()
)
);
I don’t understand what you mean by rotating about the Y axis. Do you mean rotating about its center point? If so:
mouseEnter: (e, shape) => {
shape.part.isHighlighted = true;
new go.Animation().add(shape, "angle", shape.angle, shape.angle+360).start();
},