hookehuyr

refactor(animation): 调整SVG视图框高度并移除节点点击事件

调整SVG视图框的高度以适配更多内容,并移除不再需要的节点点击事件处理函数,以简化代码逻辑。
1 <!-- 1 <!--
2 * @Date: 2025-03-28 09:23:04 2 * @Date: 2025-03-28 09:23:04
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-03-28 13:44:59 4 + * @LastEditTime: 2025-03-28 14:16:41
5 * @FilePath: /mlaj/src/views/animation.vue 5 * @FilePath: /mlaj/src/views/animation.vue
6 * @Description: 贝塞尔曲线动画路径组件 6 * @Description: 贝塞尔曲线动画路径组件
7 * 7 *
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 <div style="position: fixed; top: 0; right: 0;"> 17 <div style="position: fixed; top: 0; right: 0;">
18 <button class="next-button" @click="nextStep" :disabled="activeNodeIndex >= points.length - 1">下一步</button> 18 <button class="next-button" @click="nextStep" :disabled="activeNodeIndex >= points.length - 1">下一步</button>
19 </div> 19 </div>
20 - <svg width="100%" height="100%" viewBox="0 0 1000 1000" class="animation-svg"> 20 + <svg width="100%" height="100%" viewBox="0 0 1000 1200" class="animation-svg">
21 <!-- 定义箭头标记 --> 21 <!-- 定义箭头标记 -->
22 <defs> 22 <defs>
23 <marker 23 <marker
...@@ -78,7 +78,6 @@ ...@@ -78,7 +78,6 @@
78 :cy="point.y" 78 :cy="point.y"
79 r="12" 79 r="12"
80 :class="['node', { 'node-active': activeNodeIndex >= index - 1 }]" 80 :class="['node', { 'node-active': activeNodeIndex >= index - 1 }]"
81 - @click="activateNode(index)"
82 /> 81 />
83 </template> 82 </template>
84 </svg> 83 </svg>
...@@ -169,20 +168,20 @@ const pathColor = computed(() => { ...@@ -169,20 +168,20 @@ const pathColor = computed(() => {
169 // 处理节点点击事件,激活指定节点并更新路径 168 // 处理节点点击事件,激活指定节点并更新路径
170 // @param index - 被点击节点的索引 169 // @param index - 被点击节点的索引
171 // 点击节点时会激活该节点及其之前的所有节点和路径 170 // 点击节点时会激活该节点及其之前的所有节点和路径
172 -const activateNode = (index) => { 171 +// const activateNode = (index) => {
173 - activeNodeIndex.value = index; 172 +// activeNodeIndex.value = index;
174 - activePathSegments.value = []; 173 +// activePathSegments.value = [];
175 - 174 +
176 - // 重新计算所有激活的路径段 175 +// // 重新计算所有激活的路径段
177 - for (let i = 0; i < index; i++) { 176 +// for (let i = 0; i < index; i++) {
178 - const startPoint = points.value[i]; 177 +// const startPoint = points.value[i];
179 - const endPoint = points.value[i + 1]; 178 +// const endPoint = points.value[i + 1];
180 - if (endPoint) { 179 +// if (endPoint) {
181 - const segment = calculatePathSegment(startPoint, endPoint); 180 +// const segment = calculatePathSegment(startPoint, endPoint);
182 - activePathSegments.value.push(segment); 181 +// activePathSegments.value.push(segment);
183 - } 182 +// }
184 - } 183 +// }
185 -}; 184 +// };
186 185
187 // 处理下一步按钮点击事件 186 // 处理下一步按钮点击事件
188 // 激活下一个节点并创建新的高亮路径段 187 // 激活下一个节点并创建新的高亮路径段
......