Просмотр исходного кода

修复一些聚焦的问题,todo:先把 lock 不使用

yemeishu 1 месяц назад
Родитель
Сommit
82bf17eeba
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      public/js/knowledge-mindmap-graph.js

+ 5 - 4
public/js/knowledge-mindmap-graph.js

@@ -484,15 +484,15 @@ class KnowledgeMindmapGraph {
     bindEvents() {
         if (!this.graph) return;
 
-        this.graph.on('node:mouseenter', (evt) => {
+        this.graph.on('node:mouseover', (evt) => {
             const item = evt.item;
-            if (!item || item.getModel().locked) return;
+            // if (!item || item.getModel().locked) return;
             this.graph.setItemState(item, 'hover', true);
             this.highlightNeighbors(item.getModel().id);
             this.showTooltip(evt, item.getModel());
         });
 
-        this.graph.on('node:mouseleave', (evt) => {
+        this.graph.on('node:mouseout', (evt) => {
             const item = evt.item;
             if (!item) return;
             this.graph.setItemState(item, 'hover', false);
@@ -691,6 +691,7 @@ class KnowledgeMindmapGraph {
 
         const item = this.graph.findById(targetId);
         if (item) {
+            this.graph.zoom(2);
             this.graph.focusItem(item, true, {
                 easing: 'easeCubic',
                 duration: 500,
@@ -793,7 +794,7 @@ class KnowledgeMindmapGraph {
         this.clickTimer = setTimeout(() => {
             const model = evt.item?.getModel();
             if (!model) return;
-            if (model.locked) return;
+            // if (model.locked) return;
 
             this.graph.getNodes().forEach((node) => {
                 this.graph.clearItemStates(node);