选中一个节点,移动另一节点时,虚影错误 bug
版本
3.11
环境
系统、浏览器、React 等版本信息
重现链接
https://codesandbox.io/s/determined-einstein-x1vdo?file=/src/App.js
重现步骤
选中其中一个节点,并保持选中状态,然后移动另一个节点
期望的结果是什么
移动时,出来的虚影是所移动的节点所产生的
实际的结果是什么
移动时,出来的虚影是为选中状态节点所产生的
@gaoli 大佬有时间看看吗?翻翻牌子
你这重现示例,跑不起来。

自己写补丁
import { Util, constants } from 'gg-editor'
const { isMind, isEdge, clearSelectedState } = Util
const { ItemState, GraphState, EditorEvent } = constants
let curSelected let curSelectItems
export default { getEvents() { return { 'node:dragstart': 'handleItemDragStart', 'node:dragend': 'handleItemDragEnd', }; },
handleItemDragStart({ item }) { const { graph } = this;
if (isMind(graph) && isEdge(item)) {
return;
}
const isSelected = item.hasState(ItemState.Selected);
curSelectItems = graph.findAllByState('node', ItemState.Selected);
curSelected = isSelected
clearSelectedState(graph);
graph.emit(EditorEvent.onGraphStateChange, {
graphState: GraphState.CanvasSelected,
});
graph.setItemState(item, ItemState.Selected, true);
},
handleItemDragEnd({ item }) { const { graph } = this;
graph.setItemState(item, ItemState.Selected, false);
clearSelectedState(graph);
} }
参考:https://github.com/alibaba/GGEditor/issues/530#issuecomment-660928769