refactor(store): rename nodeLookup to nodeInternals
This commit is contained in:
@@ -6,7 +6,7 @@ import { getBezierPath } from '../Edges/BezierEdge';
|
||||
import { getSmoothStepPath } from '../Edges/SmoothStepEdge';
|
||||
import {
|
||||
ElementId,
|
||||
NodeLookupItem,
|
||||
NodeInternalsItem,
|
||||
HandleElement,
|
||||
Position,
|
||||
ConnectionLineType,
|
||||
@@ -28,7 +28,7 @@ interface ConnectionLineProps {
|
||||
CustomConnectionLineComponent?: ConnectionLineComponent;
|
||||
}
|
||||
|
||||
const selector = (s: ReactFlowState) => ({ nodeLookup: s.nodeLookup, nodes: s.nodes, transform: s.transform });
|
||||
const selector = (s: ReactFlowState) => ({ nodeInternals: s.nodeInternals, nodes: s.nodes, transform: s.transform });
|
||||
|
||||
export default ({
|
||||
connectionNodeId,
|
||||
@@ -44,8 +44,8 @@ export default ({
|
||||
const nodeId = connectionNodeId;
|
||||
const handleId = connectionHandleId;
|
||||
|
||||
const { nodeLookup, nodes, transform } = useStore(selector, shallow);
|
||||
const sourceNodeInternals = useRef<NodeLookupItem | undefined>(nodeLookup.get(nodeId));
|
||||
const { nodeInternals, nodes, transform } = useStore(selector, shallow);
|
||||
const sourceNodeInternals = useRef<NodeInternalsItem | undefined>(nodeInternals.get(nodeId));
|
||||
const sourceNode = useRef<Node | undefined>(nodes.find((n) => n.id === nodeId));
|
||||
|
||||
if (
|
||||
|
||||
@@ -66,12 +66,11 @@ export default (NodeComponent: ComponentType<NodeComponentProps>) => {
|
||||
const nodeStyle: CSSProperties = useMemo(
|
||||
() => ({
|
||||
zIndex,
|
||||
// zIndex: isSelected ? zIndex + 1 : zIndex,
|
||||
transform: `translate(${xPos}px,${yPos}px)`,
|
||||
pointerEvents:
|
||||
isSelectable || isDraggable || onClick || onMouseEnter || onMouseMove || onMouseLeave ? 'all' : 'none',
|
||||
// prevents jumping of nodes on start
|
||||
// opacity: isInitialized ? 1 : 0,
|
||||
opacity: isInitialized ? 1 : 0,
|
||||
...style,
|
||||
}),
|
||||
[
|
||||
@@ -87,6 +86,7 @@ export default (NodeComponent: ComponentType<NodeComponentProps>) => {
|
||||
onMouseMove,
|
||||
onMouseLeave,
|
||||
isParentNode,
|
||||
zIndex,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user