fix(extension): 【dynamic-group】DynamicGroup 使用 moveNode 进行移动时子节点没有跟随移动 #2007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在 #1858 中,分组内节点跟随移动的逻辑被放在了 node:mousemove 事件监听中,导致只有拖拽才会触发该逻辑。对分组使用 Api 如 moveNode 时,不会触发这个事件,子节点不跟随。
现将跟随移到逻辑改到 getMoveDistance 中,拖拽和使用方法进行移动时均会执行该方法。
同时,selection-select 插件中有问题,在选择到分组节点时,会将子节点也选中,导致在做了上面的修改后,子节点会移动 n 次。
selection-select 的代码里有对分组情况的处理:
这样的判断在单独使用分组插件时,会有另一个 if 触发,选中节点。现在修复了该逻辑,不会影响到分组的移动
效果:
这样处理后也能修复 #1949 ,这种场景下,鼠标没有移动,所以不触发事件
效果: