GGEditor icon indicating copy to clipboard operation
GGEditor copied to clipboard

选中一个节点,移动另一节点时,虚影错误 bug

Open Leo0925 opened this issue 4 years ago • 3 comments

版本

3.11

环境

系统、浏览器、React 等版本信息

重现链接

https://codesandbox.io/s/determined-einstein-x1vdo?file=/src/App.js

重现步骤

选中其中一个节点,并保持选中状态,然后移动另一个节点

期望的结果是什么

移动时,出来的虚影是所移动的节点所产生的

实际的结果是什么

移动时,出来的虚影是为选中状态节点所产生的

@gaoli 大佬有时间看看吗?翻翻牌子

Leo0925 avatar Jul 06 '20 12:07 Leo0925

你这重现示例,跑不起来。

image

blueju avatar Jul 10 '20 03:07 blueju

自己写补丁

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);

} }

426-330 avatar Jul 16 '20 12:07 426-330

参考:https://github.com/alibaba/GGEditor/issues/530#issuecomment-660928769

Ynewtime avatar Jul 28 '20 06:07 Ynewtime