Merge branch 'main' into refactor/redux
This commit is contained in:
+6
-2
@@ -1,4 +1,7 @@
|
||||
import { Store } from 'redux';
|
||||
|
||||
import { clampPosition } from '../utils';
|
||||
|
||||
import {
|
||||
ElementId,
|
||||
Node,
|
||||
@@ -11,6 +14,7 @@ import {
|
||||
Connection,
|
||||
FlowExportObject,
|
||||
ReactFlowState,
|
||||
NodeExtent,
|
||||
} from '../types';
|
||||
|
||||
export const isEdge = (element: Node | Connection | Edge): element is Edge =>
|
||||
@@ -142,7 +146,7 @@ export const onLoadProject = (currentStore: Store<ReactFlowState>) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const parseElement = (element: Node | Edge): Node | Edge => {
|
||||
export const parseElement = (element: Node | Edge, nodeExtent: NodeExtent): Node | Edge => {
|
||||
if (!element.id) {
|
||||
throw new Error('All nodes and edges need to have an id.');
|
||||
}
|
||||
@@ -164,7 +168,7 @@ export const parseElement = (element: Node | Edge): Node | Edge => {
|
||||
id: element.id.toString(),
|
||||
type: element.type || 'default',
|
||||
__rf: {
|
||||
position: element.position,
|
||||
position: clampPosition(element.position, nodeExtent),
|
||||
width: null,
|
||||
height: null,
|
||||
handleBounds: {},
|
||||
|
||||
Reference in New Issue
Block a user