My code:
mouseEnter: function (e, node) {
addAndRemoveNode(node, 1)
},
mouseLeave: function (e, node) {
addAndRemoveNode(node, 2)
}
function addAndRemoveNode(node, type) {
if (type == 1) {
var node1 = new go.Node(go.Panel.Auto);
node1.position = new go.Point(node.$f.x + 30, node.$f.y + 30);
var textblock = new go.TextBlock();
textblock.text = “hello!”;
textblock.margin = 5;
node1.add(textblock);
myDiagram.add(node1);
}
else myDiagram.remove();
}
question: Event mouseEnter add a Node then Event mouseLeave i want remove it but not working. Help me!