fix:node and edge mouseenter

This commit is contained in:
Yanyan-Wang 2018-07-24 15:12:11 +08:00
parent b2f77356cb
commit d40d247b85

View File

@ -205,27 +205,25 @@ class Plugin {
setListener() { setListener() {
let clickOnNode = null; let clickOnNode = null;
const graph = this.graph; const graph = this.graph;
graph.on('mouseenter', item => { graph.on('node:mouseenter', item => {
if (item.item != null) { if (item.item != null) {
graph.activeItem(item.item); graph.activeItem(item.item);
} }
}); });
graph.on('mouseleave', item => { graph.on('node:mouseleave', item => {
let style = {};
if (item.item != null) {
switch (item.item.type) {
case 'node':
style = node_style;
break;
case 'edge':
style = edge_style;
break;
default:
break;
}
}
graph.update(item.item, { graph.update(item.item, {
style style: node_style
});
});
graph.on('edge:mouseenter', item => {
if (item.item != null) {
graph.activeItem(item.item);
}
});
graph.on('edge:mouseleave', item => {
graph.update(item.item, {
style: edge_style
}); });
}); });