Skip to content

fix: 修复 Section 移动时速度叠加的问题#659

Open
Ezlmt wants to merge 1 commit intographif:masterfrom
Ezlmt:fix/section-move-speed-doubling
Open

fix: 修复 Section 移动时速度叠加的问题#659
Ezlmt wants to merge 1 commit intographif:masterfrom
Ezlmt:fix/section-move-speed-doubling

Conversation

@Ezlmt
Copy link

@Ezlmt Ezlmt commented Feb 25, 2026

修复两个 Section 移动时速度叠加的 bug:

Bug 1: 选中 Section 并选中内部节点时,拖动移动速度加倍 #361

  • 复现步骤:选中一个 Section,同时选中其内部的节点,然后拖动移动
  • 原因Section.move() 会遍历所有子节点并调用 child.move(),但已被选中的子节点也会被 moveSelectedEntities() 单独移动,导致移动两次

Bug 2: 嵌套 Section 移除子节点后,拖动父级 Section 导致速度加倍

  • 复现步骤:创建 Section1 → Section2 → Section3 嵌套结构,将 Section3 从 Section2 中 jump 出去,然后拖动 Section1
  • 原因convertSectionToTextNode() 中,先添加新的 TextNode 到父 Section,再删除旧 Section,但旧 Section 的引用仍在 children 数组中。updateReferences() 根据 UUID 查找时,由于新旧对象 UUID 相同,导致 TextNode 被添加两次到 children 数组

修复方案

1. Bug 1:在 Section.move() 中跳过已被选中的子元素

2. Bug 2:在 convertSectionToTextNode() 中,先从父 Section 的 children 数组移除旧引用,再添加新的 TextNode

修复前后对比


修复前

before.mp4

修复后

after.mp4

- 修复选中 Section 并选中内部节点时,拖动移动速度加倍的问题
- 修复嵌套 Section 移除子节点后,拖动父级 Section 导致速度加倍的问题

Bug 1: Section.move() 中跳过已选中的子元素,避免重复移动
Bug 2: convertSectionToTextNode() 中先移除旧引用再添加新 TextNode,
       避免 updateReferences() 因 UUID 相同导致同一对象被添加两次
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant