feat(canvas): implement local node size pinning and reconciliation logic
- Added functions to handle local node size pins, ensuring that node sizes are preserved during reconciliation. - Updated `reconcileCanvasFlowNodes` to incorporate size pinning logic. - Enhanced tests to verify the correct behavior of size pinning in various scenarios. - Updated related components to support new size pinning functionality.
This commit is contained in:
@@ -39,6 +39,7 @@ type HarnessProps = {
|
||||
previousConvexNodeIdsSnapshot: Set<string>;
|
||||
pendingLocalPositionPins?: Map<string, { x: number; y: number }>;
|
||||
pendingLocalNodeDataPins?: Map<string, unknown>;
|
||||
pendingLocalNodeSizePins?: Map<string, { width: number; height: number }>;
|
||||
preferLocalPositionNodeIds?: Set<string>;
|
||||
isResizingRefOverride?: { current: boolean };
|
||||
};
|
||||
@@ -82,6 +83,9 @@ function HookHarness(props: HarnessProps) {
|
||||
const pendingLocalNodeDataUntilConvexMatchesRef = useRef(
|
||||
props.pendingLocalNodeDataPins ?? new Map<string, unknown>(),
|
||||
);
|
||||
const pendingLocalNodeSizeUntilConvexMatchesRef = useRef(
|
||||
props.pendingLocalNodeSizePins ?? new Map<string, { width: number; height: number }>(),
|
||||
);
|
||||
const preferLocalPositionNodeIdsRef = useRef(
|
||||
props.preferLocalPositionNodeIds ?? new Set<string>(),
|
||||
);
|
||||
@@ -120,6 +124,7 @@ function HookHarness(props: HarnessProps) {
|
||||
pendingConnectionCreatesRef,
|
||||
pendingLocalPositionUntilConvexMatchesRef,
|
||||
pendingLocalNodeDataUntilConvexMatchesRef,
|
||||
pendingLocalNodeSizeUntilConvexMatchesRef,
|
||||
preferLocalPositionNodeIdsRef,
|
||||
isDragging: isDraggingRef,
|
||||
isResizing: isResizingRef,
|
||||
|
||||
Reference in New Issue
Block a user