From 11f0bca1a90ee76c529de6ee392b8ccb19cb978f Mon Sep 17 00:00:00 2001 From: ezlmt <2876187491@qq.com> Date: Tue, 24 Feb 2026 18:33:35 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Section=20=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E9=80=9F=E5=BA=A6=E5=8F=A0=E5=8A=A0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复选中 Section 并选中内部节点时,拖动移动速度加倍的问题 - 修复嵌套 Section 移除子节点后,拖动父级 Section 导致速度加倍的问题 Bug 1: Section.move() 中跳过已选中的子元素,避免重复移动 Bug 2: convertSectionToTextNode() 中先移除旧引用再添加新 TextNode, 避免 updateReferences() 因 UUID 相同导致同一对象被添加两次 --- .../concreteMethods/StageSectionInOutManager.tsx | 5 +++++ app/src/core/stage/stageObject/entity/Section.tsx | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/app/src/core/stage/stageManager/concreteMethods/StageSectionInOutManager.tsx b/app/src/core/stage/stageManager/concreteMethods/StageSectionInOutManager.tsx index 3d3fcadb2..10df8f65e 100644 --- a/app/src/core/stage/stageManager/concreteMethods/StageSectionInOutManager.tsx +++ b/app/src/core/stage/stageManager/concreteMethods/StageSectionInOutManager.tsx @@ -90,6 +90,11 @@ export class SectionInOutManager { // 获取section的父级section const fatherSections = this.project.sectionMethods.getFatherSections(section); + // 先从父 section 的 children 中移除旧的 section 引用(直接操作数组,避免触发 sectionDropChild 的连锁反应) + for (const fatherSection of fatherSections) { + fatherSection.children = fatherSection.children.filter((child) => child.uuid !== section.uuid); + } + // 创建新的TextNode,保持UUID不变 const textNode = new TextNode(this.project, { uuid: section.uuid, // 保持UUID不变 diff --git a/app/src/core/stage/stageObject/entity/Section.tsx b/app/src/core/stage/stageObject/entity/Section.tsx index 64b554cd9..9f944bdcc 100644 --- a/app/src/core/stage/stageObject/entity/Section.tsx +++ b/app/src/core/stage/stageObject/entity/Section.tsx @@ -228,6 +228,10 @@ export class Section extends ConnectableEntity { } // 让内部元素也移动 for (const child of this.children) { + // 跳过已被选中的子元素,避免重复移动(解决速度叠加bug) + if (child.isSelected) { + continue; + } child.move(delta); }