From 06b2be3bbb48e0275fbd25624c1cce54a7cac2b1 Mon Sep 17 00:00:00 2001
From: 董国庆 <364620639@qq.com>
Date: 星期二, 20 五月 2025 16:44:34 +0800
Subject: [PATCH] Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory

---
 culture/src/views/pedigree-chart/addProgenitor.vue |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/culture/src/views/pedigree-chart/addProgenitor.vue b/culture/src/views/pedigree-chart/addProgenitor.vue
index 885a190..6b1f28f 100644
--- a/culture/src/views/pedigree-chart/addProgenitor.vue
+++ b/culture/src/views/pedigree-chart/addProgenitor.vue
@@ -644,35 +644,37 @@
       // 监听窗口大小变化
       window.addEventListener('resize', this.handleResize);
 
-      // 节点点击事件
-      this.graph.on('node:click', (evt) => {
+      const handleNodeClick = (evt) => {
+        evt.preventDefault(); // 阻止默认触摸行为
         const node = evt.item;
         const nodeModel = node.getModel();
-
         // 如果节点已废弃,不允许任何操作
         if (!nodeModel.isDiscarded) {
           this.$message.warning('该节点已废弃,不能进行操作');
           return;
         }
-
         // 更新选中节点
         this.selectedNode = nodeModel;
-
         // 更新节点选中状态
         this.graphData.nodes.forEach(n => {
           n.selected = n.id === nodeModel.id;
         });
         this.graph.changeData(this.graphData);
-      });
+      };
+      this.graph.on('node:click', handleNodeClick);
+      this.graph.on('node:touchstart', handleNodeClick);
 
-      // 画布点击事件,取消选中节点
-      this.graph.on('canvas:click', () => {
+      // 画布点击事件,取消选中节点(添加触摸支持)
+      const handleCanvasClick = (evt) => {
+        evt.preventDefault();
         this.selectedNode = null;
         this.graphData.nodes.forEach(n => {
           n.selected = false;
         });
         this.graph.changeData(this.graphData);
-      });
+      };
+      this.graph.on('canvas:click', handleCanvasClick);
+      this.graph.on('canvas:touchstart', handleCanvasClick);
     },
     handleResize() {
       if (this.graph) {

--
Gitblit v1.7.1