refactor(selection): only fire selection changes that changed

This commit is contained in:
moklick
2021-11-26 18:42:52 +01:00
parent d260abec75
commit 330eefe695
11 changed files with 191 additions and 204 deletions
+1 -7
View File
@@ -1,4 +1,4 @@
import { Node, Edge, NodeInternals, NodeInternalsItem, XYZPosition } from '../types';
import { Node, NodeInternals, NodeInternalsItem, XYZPosition } from '../types';
import { isNumeric } from '../utils';
type ParentNodes = Record<string, boolean>;
@@ -104,9 +104,3 @@ export function createNodeInternals(nodes: Node[], nodeInternals: NodeInternals)
return nextNodeInternals;
}
export const createNodeOrEdgeSelectionChange = (selected: boolean) => (item: Node | Edge | string) => ({
id: typeof item === 'string' ? item : item.id,
type: 'select',
selected,
});