From d40d247b853ee63cf8e785d9d23b0589fff547f1 Mon Sep 17 00:00:00 2001 From: Yanyan-Wang Date: Tue, 24 Jul 2018 15:12:11 +0800 Subject: [PATCH] fix:node and edge mouseenter --- plugins/template.maxSpanningForest/index.js | 30 ++++++++++----------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/plugins/template.maxSpanningForest/index.js b/plugins/template.maxSpanningForest/index.js index e6b9d81b41..0c49ea7373 100644 --- a/plugins/template.maxSpanningForest/index.js +++ b/plugins/template.maxSpanningForest/index.js @@ -205,27 +205,25 @@ class Plugin { setListener() { let clickOnNode = null; const graph = this.graph; - graph.on('mouseenter', item => { + graph.on('node:mouseenter', item => { if (item.item != null) { graph.activeItem(item.item); } }); - graph.on('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.on('node:mouseleave', 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 }); });